From: Abhishek Raut Date: Sun, 9 Mar 2014 14:26:29 +0000 (-0700) Subject: Add missing ondelete option to Cisco N1kv tables X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=ccfe47d4b9c2abaa25b3b2a2dc655c32beb0b377;p=openstack-build%2Fneutron-build.git 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 --- 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 293d051c4..380a236ed 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') )