**** CubicPower OpenStack Study ****
def upgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.create_table('networkgateways',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('name', sa.String(length=255), nullable=True),
sa.Column('tenant_id', sa.String(length=36),
nullable=True),
sa.Column('default', sa.Boolean(), nullable=True),
sa.PrimaryKeyConstraint('id'))
op.create_table('networkgatewaydevices',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('network_gateway_id', sa.String(length=36),
nullable=True),
sa.Column('interface_name', sa.String(length=64),
nullable=True),
sa.ForeignKeyConstraint(['network_gateway_id'],
['networkgateways.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id'))
op.create_table('networkconnections',
sa.Column('tenant_id', sa.String(length=255),
nullable=True),
sa.Column('network_gateway_id', sa.String(length=36),
nullable=True),
sa.Column('network_id', sa.String(length=36),
nullable=True),
sa.Column('segmentation_type',
sa.Enum('flat', 'vlan',
name="net_conn_seg_type"),
nullable=True),
sa.Column('segmentation_id', sa.Integer(),
nullable=True),
sa.Column('port_id', sa.String(length=36),
nullable=False),
sa.ForeignKeyConstraint(['network_gateway_id'],
['networkgateways.id'],
ondelete='CASCADE'),
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
ondelete='CASCADE'),
sa.ForeignKeyConstraint(['port_id'], ['ports.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('port_id'),
sa.UniqueConstraint('network_gateway_id',
'segmentation_type',
'segmentation_id'))
**** CubicPower OpenStack Study ****
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.drop_table('networkconnections')
op.drop_table('networkgatewaydevices')
op.drop_table('networkgateways')