From 2a2542e963a2c39ab728b72c9b85a940b3fe16aa Mon Sep 17 00:00:00 2001 From: Abhishek Raut Date: Sun, 9 Mar 2014 07:26:29 -0700 Subject: [PATCH] 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 --- .../versions/c88b6b5fea3_cisco_n1kv_tables.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/neutron/db/migration/alembic_migrations/versions/c88b6b5fea3_cisco_n1kv_tables.py b/neutron/db/migration/alembic_migrations/versions/c88b6b5fea3_cisco_n1kv_tables.py index 293d051c4b..380a236ed3 100644 --- a/neutron/db/migration/alembic_migrations/versions/c88b6b5fea3_cisco_n1kv_tables.py +++ b/neutron/db/migration/alembic_migrations/versions/c88b6b5fea3_cisco_n1kv_tables.py @@ -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') )