¡@

Home 

OpenStack Study: 006_snapshots_add_provider_location.py

OpenStack Index

**** CubicPower OpenStack Study ****

def upgrade(migrate_engine):

    meta = MetaData()

    meta.bind = migrate_engine

    snapshots = Table('snapshots', meta, autoload=True)

    provider_location = Column('provider_location', String(255))

    snapshots.create_column(provider_location)

    snapshots.update().values(provider_location=None).execute()

**** CubicPower OpenStack Study ****

def downgrade(migrate_engine):

    meta = MetaData()

    meta.bind = migrate_engine

    snapshots = Table('snapshots', meta, autoload=True)

    provider_location = snapshots.columns.provider_location

    snapshots.drop_column(provider_location)