Dropping ForeignKeyConstraints does not work with sqlite

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

Bug Description

This is blocking a change in a nova migration:


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:


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.:


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


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!


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.