Mercurial > kallithea
comparison rhodecode/lib/dbmigrate/migrate/versioning/templates/manage/pylons.py_tmpl @ 833:9753e0907827 beta
added dbmigrate package, added model changes
moved out upgrade db command to that package
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 11 Dec 2010 01:54:12 +0100 |
parents | |
children | 5b2cf21b1947 |
comparison
equal
deleted
inserted
replaced
832:634596f81cfd | 833:9753e0907827 |
---|---|
1 #!/usr/bin/python | |
2 # -*- coding: utf-8 -*- | |
3 import sys | |
4 | |
5 from sqlalchemy import engine_from_config | |
6 from paste.deploy.loadwsgi import ConfigLoader | |
7 | |
8 from migrate.versioning.shell import main | |
9 from {{ locals().pop('repository_name') }}.model import migrations | |
10 | |
11 | |
12 if '-c' in sys.argv: | |
13 pos = sys.argv.index('-c') | |
14 conf_path = sys.argv[pos + 1] | |
15 del sys.argv[pos:pos + 2] | |
16 else: | |
17 conf_path = 'development.ini' | |
18 | |
19 {{py: | |
20 _vars = locals().copy() | |
21 del _vars['__template_name__'] | |
22 defaults = ", ".join(["%s='%s'" % var for var in _vars.iteritems()]) | |
23 }} | |
24 | |
25 conf_dict = ConfigLoader(conf_path).parser._sections['app:main'] | |
26 | |
27 # migrate supports passing url as an existing Engine instance (since 0.6.0) | |
28 # usage: migrate -c path/to/config.ini COMMANDS | |
29 main(url=engine_from_config(conf_dict), repository=migrations.__path__[0],{{ defaults }}) |