**** CubicPower OpenStack Study ****
def upgrade(migrate_engine):
"""Add bootable column to volumes."""
meta = MetaData()
meta.bind = migrate_engine
volumes = Table('volumes', meta, autoload=True)
bootable = Column('bootable', Boolean)
volumes.create_column(bootable)
volumes.update().values(bootable=False).execute()
glance_metadata = Table('volume_glance_metadata', meta, autoload=True)
glance_items = list(glance_metadata.select().execute())
for item in glance_items:
volumes.update().\
where(volumes.c.id == item['volume_id']).\
values(bootable=True).execute()
**** CubicPower OpenStack Study ****
def downgrade(migrate_engine):
"""Remove bootable column to volumes."""
meta = MetaData()
meta.bind = migrate_engine
volumes = Table('volumes', meta, autoload=True)
bootable = volumes.columns.bootable
#bootable = Column('bootable', Boolean)
volumes.drop_column(bootable)