¡@

Home 

OpenStack Study: 2a3bae1ceb8_nec_port_binding.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_table(

        'portbindingports',

        sa.Column('port_id', sa.String(length=36), nullable=False),

        sa.Column('host', sa.String(length=255), nullable=False),

        sa.ForeignKeyConstraint(['port_id'], ['ports.id'], ondelete='CASCADE'),

        sa.PrimaryKeyConstraint('port_id')

    )

    op.create_foreign_key(

        'portinfos_ibfk_1',

        source='portinfos', referent='ports',

        local_cols=['id'], 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('portinfos_ibfk_1', 'portinfos', 'foreignkey')

    op.drop_table('portbindingports')