Add missing ondelete option to Cisco N1kv tables

Update the DB migration script, which creates the Cisco N1kv tables,
to include the ondelete='CASCADE' option in network and port
binding tables. This allows proper clean up of network and port
binding entries on respective delete operations, when the tables
are populated via DB migration script.

Closes-Bug: #1294434

Change-Id: I5dad7bd718b75cfd8825b08336e834d64bddd196
This commit is contained in:
Abhishek Raut 2014-03-09 07:26:29 -07:00
parent ad57ebb143
commit 2a2542e963

View File

@ -96,7 +96,7 @@ def upgrade(active_plugins=None, options=None):
'cisco_n1kv_port_bindings',
sa.Column('port_id', sa.String(length=36), nullable=False),
sa.Column('profile_id', sa.String(length=36), nullable=True),
sa.ForeignKeyConstraint(['port_id'], ['ports.id']),
sa.ForeignKeyConstraint(['port_id'], ['ports.id'], ondelete='CASCADE'),
sa.ForeignKeyConstraint(['profile_id'], ['cisco_policy_profiles.id']),
sa.PrimaryKeyConstraint('port_id')
)
@ -122,7 +122,8 @@ def upgrade(active_plugins=None, options=None):
nullable=True),
sa.Column('multicast_ip', sa.String(length=32), nullable=True),
sa.Column('profile_id', sa.String(length=36), nullable=True),
sa.ForeignKeyConstraint(['network_id'], ['networks.id']),
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
ondelete='CASCADE'),
sa.ForeignKeyConstraint(['profile_id'], ['cisco_network_profiles.id']),
sa.PrimaryKeyConstraint('network_id')
)