This file is indexed.

/usr/share/pyshared/devtools/commands/migration.py is in python-tg.devtools 2.0.2-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
"""
TurboGears migration

paster migrate command integrate sqlalchemy-migrate into TurboGears 2.

To start a migration, run command::

    $ paster migrate create

And migrate command will create a 'migration' directory for you.
With migrate command you don't need use 'manage.py' in 'migration' directory anymore.

Then you could bind the database with migration with command::

    $ paster migrate version_control

Usage:

.. parsed-literal::

   paster migrate help
   paster migrate create
   paster migrate vc|version_control
   paster migrate dbv|db_version
   paster migrate v|version
   paster migrate manage [script.py]
   paster migrate test [script.py]
   paster migrate ci|commit [script.py]
   paster migrate up|upgrade [--version]
   paster migrate downgrade [--version]

.. container:: paster-usage

  --version
      database's version number

check http://code.google.com/p/sqlalchemy-migrate/wiki/MigrateVersioning for detail.

"""

from paste.script import command
import os
import ConfigParser
from migrate.versioning.shell import main

class MigrateCommand(command.Command):
    """Sqlalchemy migration"""
    max_args = 3
    min_args = 1
    summary = __doc__.splitlines()[0]
    usage = '\n' + __doc__
    group_name = "TurboGears2"

    parser = command.Command.standard_parser(verbose=True)

    def command(self):
        ini = 'development.ini'
        sect = 'app:main'
        option = 'sqlalchemy.url'

        # get sqlalchemy.url config in app:mains
        curdir = os.getcwd()
        conf = ConfigParser.ConfigParser()
        conf.read(os.path.join(curdir, ini))

        self.name = "migration"
        try:
            self.dburi = conf.get(sect, option, vars={'here':curdir})
        except:
            print "you shold set sqlalchemy.url in development.ini first"

        print "The repository is '%s'\nThe url is '%s'"%(self.name, self.dburi)
        main(argv=self.args, url=self.dburi,repository=self.name, name=self.name)