¡@

Home 

OpenStack Study: 031_drop_credential_indexes.py

OpenStack Index

**** CubicPower OpenStack Study ****

def upgrade(migrate_engine):

    #This migration is relevant only for mysql because for all other

    #migrate engines these indexes were successfully dropped.

    if migrate_engine.name != 'mysql':

        return

    meta = sqlalchemy.MetaData(bind=migrate_engine)

    table = sqlalchemy.Table('credential', meta, autoload=True)

    for index in table.indexes:

        index.drop()

**** CubicPower OpenStack Study ****

def downgrade(migrate_engine):

    if migrate_engine.name != 'mysql':

        return

    meta = sqlalchemy.MetaData(bind=migrate_engine)

    table = sqlalchemy.Table('credential', meta, autoload=True)

    index = sqlalchemy.Index('user_id', table.c['user_id'])

    index.create()

    index = sqlalchemy.Index('credential_project_id_fkey',

                             table.c['project_id'])

    index.create()