sqlite alter table messes foreign keys

Bug #1552351 reported by Pierre Tardy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
sqlalchemy-migrate
New
Undecided
Unassigned

Bug Description

I am trying to enable sqlite3 fk support in buildbot.

on my system, following command:
ALTER TABLE %s RENAME TO migration_tmp

will also rename foreign key contraints from *other* tables to migration_tmp

If I change the code to:

+ self.append('pragma foreign_keys=OFF')
+ self.execute()
         self.append('ALTER TABLE %s RENAME TO migration_tmp' % table_name)
         self.execute()
+ self.append('pragma foreign_keys=ON')
+ self.execute()

then the constraints are not renamed, and the migration script can work

I am not sure exactly how to make this work apart from disabling foreign keys when doing migrations.

Revision history for this message
Pierre Tardy (tardyp) wrote :

FYI, this is the context code.
https://github.com/buildbot/buildbot/pull/2024

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.