From: Ann Kamyshnikova Date: Fri, 13 Feb 2015 12:52:49 +0000 (+0300) Subject: Fix usage drop_constraint in 2a1ee2fb59e0 migration X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=77c073b743a257781b068552ca2af175c4c2cd30;p=openstack-build%2Fneutron-build.git Fix usage drop_constraint in 2a1ee2fb59e0 migration Downgrade for migration 2a1ee2fb59e0_add_mac_address_unique_constraint fails as it gets wrong parameters name, source and local_cols, although it expects name, source and type_. Also as MySQL creates index for unique constraint it should be used "with migration.remove_fks_from_table". Closes-bug: #1421631 Change-Id: Id86b2f339a6fb33fc4fd637ffbfc2cb6e75ef4fb --- diff --git a/neutron/db/migration/alembic_migrations/versions/2a1ee2fb59e0_add_mac_address_unique_constraint.py b/neutron/db/migration/alembic_migrations/versions/2a1ee2fb59e0_add_mac_address_unique_constraint.py index c5af2d81b..ab8dc1cfe 100644 --- a/neutron/db/migration/alembic_migrations/versions/2a1ee2fb59e0_add_mac_address_unique_constraint.py +++ b/neutron/db/migration/alembic_migrations/versions/2a1ee2fb59e0_add_mac_address_unique_constraint.py @@ -27,6 +27,7 @@ down_revision = '41662e32bce2' from alembic import op +from neutron.db import migration TABLE_NAME = 'ports' CONSTRAINT_NAME = 'uniq_ports0network_id0mac_address' @@ -41,8 +42,9 @@ def upgrade(): def downgrade(): - op.drop_constraint( - name=CONSTRAINT_NAME, - source=TABLE_NAME, - local_cols=['network_id', 'mac_address'] - ) + with migration.remove_fks_from_table(TABLE_NAME): + op.drop_constraint( + CONSTRAINT_NAME, + TABLE_NAME, + type_='unique' + )