¡@

Home 

OpenStack Study: 1064e98b7917_nec_pf_port_del.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.alter_column('packetfilters', 'in_port',

                    existing_type=sa.String(length=36),

                    nullable=True)

    op.create_foreign_key(

        'packetfilters_ibfk_2',

        source='packetfilters', referent='ports',

        local_cols=['in_port'], remote_cols=['id'],

        ondelete='CASCADE')

**** CubicPower OpenStack Study ****

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

    if not migration.should_run(active_plugins, migration_for_plugins):

        return

    op.drop_constraint('packetfilters_ibfk_2', 'packetfilters', 'foreignkey')

    op.alter_column('packetfilters', 'in_port',

                    existing_type=sa.String(length=36),

                    nullable=False)