Mostly good (and necessary!) stuff, Andy. Nice job.
Here's a couple things to address, though (outside of the merge stuff you're currently looking at):
1) Please add sqlalchemy-migrations to tools/pip-requires otherwise tests will bomb in a virtualenv
2) Copy/paste docstring fail here :)
22 + def sync(self, version=None):
23 + """adds role to user
24 + if project is specified, adds project specific role
25 + arguments: user, role [project]"""
26 + return migration.db_sync(version)
Not sure if the above is necessary considering the nova-manage db sync. Was this just to achieve parity with Django? I didn't see this script being used anywhere.
Looks like there is something missing... db_version() returns the numeric version of the database, if it is versioned (returning 0 if not versioned). May I suggest changing the above code to the following:
def db_sync(version=1):
cur_version = db_version()
repo_path = _find_migrate_repo()
if version > cur_version:
return versioning_api.upgrade(FLAGS.sql_connection, repo_path, version)
return True
Heyo.
Mostly good (and necessary!) stuff, Andy. Nice job.
Here's a couple things to address, though (outside of the merge stuff you're currently looking at):
1) Please add sqlalchemy- migrations to tools/pip-requires otherwise tests will bomb in a virtualenv
2) Copy/paste docstring fail here :)
22 + def sync(self, version=None): db_sync( version)
23 + """adds role to user
24 + if project is specified, adds project specific role
25 + arguments: user, role [project]"""
26 + return migration.
3) Nova != Django :)
135 === added file 'nova/db/ sqlalchemy/ migrate_ repo/__ init__. py' sqlalchemy/ migrate_ repo/manage. py' sqlalchemy/ migrate_ repo/manage. py 1970-01-01 00:00:00 +0000 sqlalchemy/ migrate_ repo/manage. py 2011-01-15 02:00:45 +0000 versioning. shell import main
136 === added file 'nova/db/
137 --- nova/db/
138 +++ nova/db/
139 @@ -0,0 +1,4 @@
140 +#!/usr/bin/env python
141 +from migrate.
142 +if __name__ == '__main__':
143 + main(debug='False', repository='.')
Not sure if the above is necessary considering the nova-manage db sync. Was this just to achieve parity with Django? I didn't see this script being used anywhere.
4) This code:
951 +def db_sync( version= None): repo() api.upgrade( FLAGS.sql_ connection, repo_path, version)
952 + db_version()
953 + repo_path = _find_migrate_
954 + return versioning_
Looks like there is something missing... db_version() returns the numeric version of the database, if it is versioned (returning 0 if not versioned). May I suggest changing the above code to the following:
def db_sync(version=1): repo() api.upgrade( FLAGS.sql_ connection, repo_path, version)
cur_version = db_version()
repo_path = _find_migrate_
if version > cur_version:
return versioning_
return True
Cheers!
jay