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
This commit is contained in:
Ann Kamyshnikova 2015-02-13 15:52:49 +03:00
parent 4f5917e9e9
commit 77c073b743
1 changed files with 7 additions and 5 deletions

View File

@ -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'
)