Browse files

Ensure fkey is dropped before removing instance_id

This fixes Bug #904888

On MySQL databases that use InnoDB by default (ie, at the point when
database is being first migrated), extra care needs to be taken to
ensure FKs are dropped before columns because they are not automatically.

Patch from Adam Gandelman and Scott Moser.

Change-Id: I32919a46bb76f524e064098738ad98248b2f1c0e
  • Loading branch information...
1 parent fb8a7a6 commit 5a28a07b10c4f7fef2046c4e84929706c8351e19 @ttx ttx committed with vishvananda Dec 15, 2011
7 ...db/sqlalchemy/migrate_repo/versions/
@@ -48,6 +48,13 @@ def upgrade(migrate_engine):
+ if == "mysql":
+ try:
+ migrate_engine.execute("ALTER TABLE instance_actions " \
+ "DROP FOREIGN KEY instance_actions_ibfk_1;")
+ except Exception: # Don't care, just fail silently.
+ pass

0 comments on commit 5a28a07

Please sign in to comment.