¡@

Home 

OpenStack Study: e197124d4b9_add_unique_constrain.py

OpenStack Index

**** CubicPower OpenStack Study ****

def upgrade(active_plugins=None, options=None):

    if not migration.should_run(active_plugins, migration_for_plugins):

        return

    op.create_unique_constraint(

        name=CONSTRAINT_NAME,

        source=TABLE_NAME,

        local_cols=['pool_id', 'address', 'protocol_port']

    )

**** CubicPower OpenStack Study ****

def downgrade(active_plugins=None, options=None):

    if not migration.should_run(active_plugins, migration_for_plugins):

        return

    op.drop_constraint(

        CONSTRAINT_NAME,

        TABLE_NAME,

        type_='unique'

    )