**** CubicPower OpenStack Study ****
def upgrade(migrate_engine):
"""Function adds ephemeral storage encryption key uuid field."""
meta = MetaData(bind=migrate_engine)
instances = Table('instances', meta, autoload=True)
shadow_instances = Table('shadow_instances', meta, autoload=True)
ephemeral_key_uuid = Column('ephemeral_key_uuid', String(36))
instances.create_column(ephemeral_key_uuid)
shadow_instances.create_column(ephemeral_key_uuid.copy())
migrate_engine.execute(instances.update().
values(ephemeral_key_uuid=None))
migrate_engine.execute(shadow_instances.update().
values(ephemeral_key_uuid=None))
**** CubicPower OpenStack Study ****
def downgrade(migrate_engine):
"""Function removes ephemeral storage encryption key uuid field."""
meta = MetaData(bind=migrate_engine)
instances = Table('instances', meta, autoload=True)
shadow_instances = Table('shadow_instances', meta, autoload=True)
instances.c.ephemeral_key_uuid.drop()
shadow_instances.c.ephemeral_key_uuid.drop()