]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Add missing ondelete option to Cisco N1kv tables
authorAbhishek Raut <abhraut@cisco.com>
Sun, 9 Mar 2014 14:26:29 +0000 (07:26 -0700)
committerAbhishek Raut <abhraut@cisco.com>
Sun, 9 Mar 2014 14:31:12 +0000 (07:31 -0700)
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

neutron/db/migration/alembic_migrations/versions/c88b6b5fea3_cisco_n1kv_tables.py

index 293d051c4b07e5fa2b8c775a659ab1823b98526f..380a236ed38dfd659c38142f2422e402b5c734a4 100644 (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')
     )