Fix failed downgrade in migrations
Downgrade is failed in 13, 14 migrations. Fixes-Bug: #1221635 Change-Id: I4fda3d0a61e7fc82fc5fb2a28bcbc82ba7fadcc5
This commit is contained in:
parent
a9f147c62a
commit
91f10427ea
@ -18,16 +18,16 @@
|
||||
|
||||
from sqlalchemy import MetaData, Table
|
||||
|
||||
meta = MetaData()
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
meta = MetaData()
|
||||
meta.bind = migrate_engine
|
||||
alarm = Table('alarm', meta, autoload=True)
|
||||
alarm.c.counter_name.alter(name='meter_name')
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
meta = MetaData()
|
||||
meta.bind = migrate_engine
|
||||
alarm = Table('alarm', meta, autoload=True)
|
||||
alarm.c.meter_name.alter(name='counter_name')
|
||||
|
@ -53,10 +53,8 @@ def downgrade(migrate_engine):
|
||||
meta = sqlalchemy.MetaData(bind=migrate_engine)
|
||||
event = sqlalchemy.Table('event', meta, autoload=True)
|
||||
message_id = sqlalchemy.Column('message_id', sqlalchemy.String(50))
|
||||
event.drop_column(message_id)
|
||||
|
||||
cons = UniqueConstraint('message_id', table=event)
|
||||
cons.drop()
|
||||
|
||||
index = sqlalchemy.Index('idx_event_message_id', models.Event.message_id)
|
||||
index.drop(bind=migrate_engine)
|
||||
event.drop_column(message_id)
|
||||
|
Loading…
Reference in New Issue
Block a user