L2 gateway migration skip

Skip l2 gw migration if the table does not exist

Change-Id: Ib88e10e7c377d8dc1dece75fae1307174ff827cb
This commit is contained in:
Gary Kotton 2015-09-16 04:16:38 -07:00
parent 7a3340e13a
commit c7ed3b42f3

View File

@ -30,14 +30,19 @@ import sqlalchemy as sa
def upgrade(): def upgrade():
op.create_table( try:
'nsx_l2gw_connection_mappings', op.create_table(
sa.Column('connection_id', sa.String(length=36), nullable=False), 'nsx_l2gw_connection_mappings',
sa.Column('port_id', sa.String(length=36), nullable=False), sa.Column('connection_id', sa.String(length=36), nullable=False),
sa.Column('bridge_endpoint_id', sa.String(length=36), nullable=False), sa.Column('port_id', sa.String(length=36), nullable=False),
sa.ForeignKeyConstraint(['connection_id'], sa.Column('bridge_endpoint_id', sa.String(length=36),
['l2gatewayconnections.id'], nullable=False),
ondelete='CASCADE'), sa.ForeignKeyConstraint(['connection_id'],
sa.ForeignKeyConstraint(['port_id'], ['ports.id'], ondelete='CASCADE'), ['l2gatewayconnections.id'],
sa.PrimaryKeyConstraint('connection_id'), ondelete='CASCADE'),
) sa.ForeignKeyConstraint(['port_id'], ['ports.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('connection_id'),
)
except Exception:
pass