~ubuntu-branches/ubuntu/quantal/keystone/quantal-security

« back to all changes in this revision

Viewing changes to keystone/common/sql/migration.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-06-22 12:27:50 UTC
  • mto: (35.1.1 quantal-proposed)
  • mto: This revision was merged to the branch mainline in revision 28.
  • Revision ID: package-import@ubuntu.com-20120622122750-4urdq17en1990apn
Tags: upstream-2012.2~f2~20120622.2353
ImportĀ upstreamĀ versionĀ 2012.2~f2~20120622.2353

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
    current_version = db_version()
50
50
    repo_path = _find_migrate_repo()
51
51
    if version is None or version > current_version:
52
 
        return versioning_api.upgrade(
53
 
                CONF.sql.connection, repo_path, version)
 
52
        return versioning_api.upgrade(CONF.sql.connection, repo_path, version)
54
53
    else:
55
54
        return versioning_api.downgrade(
56
 
                CONF.sql.connection, repo_path, version)
 
55
            CONF.sql.connection, repo_path, version)
57
56
 
58
57
 
59
58
def db_version():
60
59
    repo_path = _find_migrate_repo()
61
60
    try:
62
 
        return versioning_api.db_version(
63
 
                CONF.sql.connection, repo_path)
 
61
        return versioning_api.db_version(CONF.sql.connection, repo_path)
64
62
    except versioning_exceptions.DatabaseNotControlledError:
65
63
        return db_version_control(0)
66
64
 
67
65
 
68
66
def db_version_control(version=None):
69
67
    repo_path = _find_migrate_repo()
70
 
    versioning_api.version_control(
71
 
            CONF.sql.connection, repo_path, version)
 
68
    versioning_api.version_control(CONF.sql.connection, repo_path, version)
72
69
    return version
73
70
 
74
71