Dropping ForeignKeyConstraints does not work with sqlite

Bug #1423955 reported by Matt Riedemann
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
sqlalchemy-migrate
Fix Committed
High
Matt Riedemann

Bug Description

This is blocking a change in a nova migration:

https://review.openstack.org/#/c/155319/7/nova/db/sqlalchemy/migrate_repo/versions/277_remove_service_fk_in_compute_nodes.py

Because of the 273 migration which added FKeys for sqlite but didn't add the downgrade option b/c of lack of support in sqlalchemy-migrate:

https://review.openstack.org/#/c/141199/

The alternative is adding .sql scripts for sqlite in other projects to basically create a temp table with the new schema, migrate data to the new table, then drop the old table and rename the temp table, e.g.:

https://review.openstack.org/#/c/107463/

That's what sqlalchemy-migrate essentially does for dropping UniqueConstraints with sqlite here:

https://review.openstack.org/#/c/87773/

We can probably do something similar for FKeys and sqlite.

Tags: sqlite
Matt Riedemann (mriedem)
Changed in sqlalchemy-migrate:
importance: Undecided → High
status: New → Triaged
Revision history for this message
Johannes Erdfelt (johannes.erdfelt) wrote :

To be fair, the 273 migration isn't causing any problems, it just took the easy way out :)

Revision history for this message
Matt Riedemann (mriedem) wrote :

Yeah, I know. We have this now though!

https://review.openstack.org/#/c/157878/

Changed in sqlalchemy-migrate:
status: Triaged → In Progress
assignee: nobody → Matt Riedemann (mriedem)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to sqlalchemy-migrate (master)

Reviewed: https://review.openstack.org/157878
Committed: https://git.openstack.org/cgit/stackforge/sqlalchemy-migrate/commit/?id=ae64d828df9debe61283ca7aa436bdbf0b49d0e7
Submitter: Jenkins
Branch: master

commit ae64d828df9debe61283ca7aa436bdbf0b49d0e7
Author: Matt Riedemann <email address hidden>
Date: Fri Feb 20 09:26:10 2015 -0800

    allow dropping fkeys with sqlite

    This implements the ability to drop foreign keys
    with sqlite. It's basically the same implementation
    used for dropping unique constraints so the common
    code is refactored.

    The existing FKey test that was skipping sqlite is
    no longer skipped to show this works.

    Change-Id: Idaaf4229e34af4c21c3bcead4b4e22491d24238e
    Closes-Bug: #1423955

Changed in sqlalchemy-migrate:
status: In Progress → Fix Committed
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.