Fix inconsistent doc string and code of db_sync

db_sync may downgrade but current doc string only says
upgrade, and it says having return value which seems not
true.

Change-Id: Ib7bbb597f621985aba956302034eb1c5d0b3ff1f
Closes-Bug: #1264193
This commit is contained in:
ZhiQiang Fan 2014-01-15 15:41:07 +08:00
parent bad366a6fe
commit 1a9f95329f
2 changed files with 7 additions and 4 deletions

View File

@ -87,7 +87,7 @@ class DbCommands(object):
help='Current Database version')
def sync(self, version=None, current_version=None):
"""
Place a database under migration control and upgrade,
Place a database under migration control and upgrade/downgrade it,
creating first if necessary.
"""
migration.db_sync(version, current_version)

View File

@ -101,7 +101,7 @@ def _version_control(version):
def db_sync(version=None, current_version=None):
"""
Place a database under migration control and perform an upgrade
Place a database under migration control and upgrade/downgrade it.
:retval version number
"""
@ -112,10 +112,13 @@ def db_sync(version=None, current_version=None):
if current_version is None:
current_version = int(db_version())
if version is not None and int(version) < current_version:
downgrade(version=version)
return downgrade(version=version)
elif version is None or int(version) > current_version:
upgrade(version=version)
return upgrade(version=version)
else:
return current_version
def get_migrate_repo_path():