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
This commit is contained in:
parent
e4a1a4fcef
commit
71f1264a8a
@ -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()
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user