db: Move sqlalchemy-migrate migrations
We're going to introduce a parallel alembic-based migrations tree. Rename the current sqlalchemy-migrate-based migrations directory to avoid confusion when this happens. We also move them up a directory since there is no need for the current nesting. Change-Id: Ia34ef67e6473fd54356be05feb367049311407f8 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
parent
94dfad99c2
commit
e823386cbe
@ -205,7 +205,7 @@ class DbCommands(object):
|
||||
def version(self):
|
||||
"""Print the current database version."""
|
||||
print(migration.db_version(db_api.get_engine(),
|
||||
db_migration.MIGRATE_REPO_PATH,
|
||||
db_migration.LEGACY_MIGRATIONS_PATH,
|
||||
db_migration.INIT_VERSION))
|
||||
|
||||
@args('age_in_days', type=int,
|
||||
@ -1020,7 +1020,7 @@ def get_arg_string(args):
|
||||
# This is long optional arg
|
||||
args = args[2:]
|
||||
else:
|
||||
args = args[1:]
|
||||
args = args[1:] # pylint: disable=E1136
|
||||
|
||||
# We convert dashes to underscores so we can have cleaner optional arg
|
||||
# names
|
||||
|
@ -17,9 +17,8 @@ import os
|
||||
|
||||
from migrate.versioning.shell import main
|
||||
|
||||
from cinder.db.sqlalchemy import migrate_repo
|
||||
REPOSITORY = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(debug='False',
|
||||
repository=os.path.abspath(os.path.dirname(migrate_repo.__file__)))
|
||||
main(debug='False', repository=REPOSITORY)
|
@ -27,10 +27,9 @@ from cinder.db.sqlalchemy import api as db_api
|
||||
options.set_defaults(cfg.CONF)
|
||||
|
||||
INIT_VERSION = 134
|
||||
MIGRATE_REPO_PATH = os.path.join(
|
||||
LEGACY_MIGRATIONS_PATH = os.path.join(
|
||||
os.path.abspath(os.path.dirname(__file__)),
|
||||
'sqlalchemy',
|
||||
'migrate_repo',
|
||||
'legacy_migrations',
|
||||
)
|
||||
|
||||
|
||||
@ -42,6 +41,6 @@ def db_sync(version=None, engine=None):
|
||||
|
||||
return migration.db_sync(
|
||||
engine=engine,
|
||||
abs_path=MIGRATE_REPO_PATH,
|
||||
abs_path=LEGACY_MIGRATIONS_PATH,
|
||||
version=version,
|
||||
init_version=INIT_VERSION)
|
||||
|
@ -32,8 +32,8 @@ from oslotest import base as test_base
|
||||
import sqlalchemy
|
||||
from sqlalchemy.engine import reflection
|
||||
|
||||
import cinder.db.legacy_migrations
|
||||
from cinder.db import migration
|
||||
import cinder.db.sqlalchemy.migrate_repo
|
||||
from cinder.tests.unit import utils as test_utils
|
||||
from cinder.volume import volume_types
|
||||
|
||||
@ -53,7 +53,7 @@ class MigrationsMixin(test_migrations.WalkVersionsMixin):
|
||||
|
||||
@property
|
||||
def REPOSITORY(self):
|
||||
migrate_file = cinder.db.sqlalchemy.migrate_repo.__file__
|
||||
migrate_file = cinder.db.legacy_migrations.__file__
|
||||
return repository.Repository(
|
||||
os.path.abspath(os.path.dirname(migrate_file)))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user