From 71f1264a8a19a26cfec0132cb265837b72fabc53 Mon Sep 17 00:00:00 2001 From: Svetlana Shturm Date: Fri, 18 Oct 2013 14:30:45 +0400 Subject: [PATCH] Fix wrong using of Metadata in 15,16 migrations In up>down>up mode migrations are failing due to using of common MetaData. It should be declared separatly for both of migration methods. Fixes-Bug: #1240898 Change-Id: I8f6555ce44204e79a9c47b7caa1fe05970f4e3f0 --- .../migrate_repo/versions/015_add_alarm_history_table.py | 4 ++-- .../sqlalchemy/migrate_repo/versions/016_simpler_alarm.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ceilometer/storage/sqlalchemy/migrate_repo/versions/015_add_alarm_history_table.py b/ceilometer/storage/sqlalchemy/migrate_repo/versions/015_add_alarm_history_table.py index 28ee1dd91..7223ba070 100644 --- a/ceilometer/storage/sqlalchemy/migrate_repo/versions/015_add_alarm_history_table.py +++ b/ceilometer/storage/sqlalchemy/migrate_repo/versions/015_add_alarm_history_table.py @@ -20,10 +20,9 @@ from migrate import ForeignKeyConstraint from sqlalchemy import MetaData, Table, Column, Index from sqlalchemy import String, DateTime -meta = MetaData() - def upgrade(migrate_engine): + meta = MetaData() meta.bind = migrate_engine project = Table('project', meta, autoload=True) @@ -68,6 +67,7 @@ def upgrade(migrate_engine): def downgrade(migrate_engine): + meta = MetaData() meta.bind = migrate_engine alarm_history = Table('alarm_history', meta, autoload=True) alarm_history.drop() diff --git a/ceilometer/storage/sqlalchemy/migrate_repo/versions/016_simpler_alarm.py b/ceilometer/storage/sqlalchemy/migrate_repo/versions/016_simpler_alarm.py index 703b7fa60..27dfd7f67 100644 --- a/ceilometer/storage/sqlalchemy/migrate_repo/versions/016_simpler_alarm.py +++ b/ceilometer/storage/sqlalchemy/migrate_repo/versions/016_simpler_alarm.py @@ -21,10 +21,9 @@ import json from sqlalchemy import MetaData, Table, Column, Index from sqlalchemy import String, Float, Integer, Text -meta = MetaData() - def upgrade(migrate_engine): + meta = MetaData() meta.bind = migrate_engine table = Table('alarm', meta, autoload=True) @@ -65,6 +64,7 @@ def upgrade(migrate_engine): def downgrade(migrate_engine): + meta = MetaData() meta.bind = migrate_engine table = Table('alarm', meta, autoload=True)