5 ms·
But, last I checked, you could PRAGMA foreign_keys=off temporarily, which would also inhibit the automatic handling of foreign key constraints in other tables w
by premchai21 14y ago
But, last I checked, you could PRAGMA foreign_keys=off temporarily, which would also inhibit the automatic handling of foreign key constraints in other tables when the target table is renamed or dropped. Then you can create a new table, populate it, drop the old one, rename the new one to the old name, and turn foreign_keys back on, and the constraints will now target the new table.
- wvenable 14y agoDoes that actually work for dropping and renaming tables? I thought I tried that.
- premchai21 14y agoIt does in 3.7.13 (and presumably older versions, but I don't have a solid record of this immediately available).
- rogerbinns 14y agoIn any event you can get the foreign keys from sqlite_master, delete them during the reorganisation and then put them back afterwards.