Improve DB migration (code to drop a foreign key constraint)

Bug #907254 reported by Cor Cornelisse
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Wishlist
Unassigned

Bug Description

Regarding:

nova/db/sqlalchemy/migrate_repo/versions/064_change_instance_id_to_uuid_in_instance_actions.py

I think it's cleaner to use SQL Alchemy to drop the foreign key constraint, since this way is used in the other schema version migrations as well. Right now version 064 looks like it has been "quick fixed" by using "If mysql -> execute drop statement".

For reference, see

nova/db/sqlalchemy/migrate_repo/versions/047_remove_instances_fk_from_vif.py

Which is properly using SQL Alchemy to remove a foreign key constraint

Proposed fix:

http://paste.openstack.org/show/3910/

Revision history for this message
Thierry Carrez (ttx) wrote :

Feel free to propose your code for merging to Gerrit, its content can be discussed in the code review.

Changed in nova:
importance: Undecided → Wishlist
status: New → Triaged
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/2505

Changed in nova:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/2505
Committed: http://github.com/openstack/nova/commit/d503d6b1079f9eafe0430754214fc5b6d4e32c09
Submitter: Jenkins
Branch: master

commit d503d6b1079f9eafe0430754214fc5b6d4e32c09
Author: Cor Cornelisse <email address hidden>
Date: Wed Dec 21 12:46:58 2011 +0100

    Use SQLAlchemy to drop foreign key in DB migrate

    A foreign key constraint needs to be removed in order to succeed in the
    DB migration. An earlier submitted fix for this uses a mysql drop
    statement. I think it's cleaner to use sqlalchemy to do this, as it's
    done this way in other version migrations as well. Fix for bug 907254.

    Update: IBM from 1928 called, they want their 80 CPL limit
    back. - on a more serious note, fixed jenkins PEP8 failure
    Update2: Replaced tab by a spaces
    Update3: Don't do Foreign Key stuff if the engine is sqlite
    Update4: Add myself to the Authors file
    Update5: With the correct mail address

    Change-Id: Ib021e0ddb2c80ee63888435a9e3761c053534160

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.