Fixes DB migrations on SQLite

Change-Id: I07960799adf07ad39582f90feba27a84979aea76
Closes-Bug: #1308089
This commit is contained in:
Stan Lagun
2014-04-15 18:32:09 +04:00
committed by Ruslan Kamaldinov
parent e91ab13ab1
commit 6291c85940

View File

@@ -21,16 +21,20 @@ meta = schema.MetaData()
def upgrade(migrate_engine): def upgrade(migrate_engine):
meta.bind = migrate_engine meta.bind = migrate_engine
table = schema.Table('instance', meta, autoload=True) table = schema.Table('instance', meta, autoload=True)
table.rename('instance_stats') table.drop()
table.delete() table = schema.Table(
type_name = schema.Column('type_name', types.String(512), nullable=False) 'instance_stats',
type_name.create(table) meta,
type_title = schema.Column('type_title', types.String(512)) schema.Column('environment_id', types.String(100), primary_key=True),
type_title.create(table) schema.Column('instance_id', types.String(100), primary_key=True),
unit_count = schema.Column('unit_count', types.Integer()) schema.Column('instance_type', types.Integer, nullable=False),
unit_count.create(table) schema.Column('created', types.Integer, nullable=False),
tenant_id = schema.Column('tenant_id', types.String(32), nullable=False) schema.Column('destroyed', types.Integer, nullable=True),
tenant_id.create(table) schema.Column('type_name', types.String(512), nullable=False),
schema.Column('type_title', types.String(512)),
schema.Column('unit_count', types.Integer()),
schema.Column('tenant_id', types.String(32), nullable=False))
table.create()
def downgrade(migrate_engine): def downgrade(migrate_engine):