From 8fde5b3a3e292e3cea2e952d874f0e1f1626a6e6 Mon Sep 17 00:00:00 2001 From: Gordon Chung Date: Thu, 13 Mar 2014 22:40:50 -0400 Subject: [PATCH] 028 migration script incorrectly skips over section 028 migration patch for alembic scripts incorrectly skips over applying former alembic script '17738166b91' when it is needed. Change-Id: I86a49f1979d8c5a8d5e5f15da8c007216b626928 Closes-Bug: #1292312 --- .../versions/028_alembic_migrations.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ceilometer/storage/sqlalchemy/migrate_repo/versions/028_alembic_migrations.py b/ceilometer/storage/sqlalchemy/migrate_repo/versions/028_alembic_migrations.py index 567620c73..d36ed442b 100644 --- a/ceilometer/storage/sqlalchemy/migrate_repo/versions/028_alembic_migrations.py +++ b/ceilometer/storage/sqlalchemy/migrate_repo/versions/028_alembic_migrations.py @@ -49,7 +49,7 @@ INDEXES = ( (['mysql'], 'source', 'id', ('id',), False, True, False)) -def index_cleanup(meta, engine_names, table_name, uniq_name, columns, +def index_cleanup(meta, table_name, uniq_name, columns, create, unique, limited): table = sa.Table(table_name, meta, autoload=True) if create: @@ -67,10 +67,11 @@ def index_cleanup(meta, engine_names, table_name, uniq_name, columns, sa.Index(uniq_name, *cols, unique=unique).create() else: if unique: - migrate.UniqueConstraint(*columns, table=table).drop() + migrate.UniqueConstraint(*columns, table=table, + name=uniq_name).drop() else: cols = [table.c[col] for col in columns] - sa.Index(uniq_name, *cols, unique=unique).drop() + sa.Index(uniq_name, *cols).drop() def change_uniq(meta, downgrade=False): @@ -130,8 +131,8 @@ def upgrade(migrate_engine): if a_ver == '17738166b91': for (engine_names, table_name, uniq_name, columns, create, uniq, limited) in INDEXES: - if migrate_engine in engine_names: - index_cleanup(meta, engine_names, table_name, uniq_name, + if migrate_engine.name in engine_names: + index_cleanup(meta, table_name, uniq_name, columns, create, uniq, limited) a_ver = 'b6ae66d05e3' @@ -148,8 +149,8 @@ def downgrade(migrate_engine): for (engine_names, table_name, uniq_name, columns, create, uniq, limited) in INDEXES: - if migrate_engine in engine_names: - index_cleanup(meta, engine_names, table_name, uniq_name, + if migrate_engine.name in engine_names: + index_cleanup(meta, table_name, uniq_name, columns, not create, uniq, limited) meter = sa.Table('meter', meta, autoload=True)