AppDbUpdater: Switch foreign keys off when heavily altering tables

This commit is contained in:
2024-02-29 10:26:58 +01:00
parent 614e0010fd
commit 92c3ed991b
2 changed files with 7 additions and 3 deletions

View File

@ -22,10 +22,12 @@ CREATE TABLE payment_delivery_part_new (
INSERT INTO payment_delivery_part_new (year, did, dpnr, avnr, net_amount, mod_abs, mod_rel)
SELECT year, did, dpnr, avnr, net_amount, mod_abs, mod_rel
FROM payment_delivery_part;
PRAGMA foreign_keys = OFF;
PRAGMA writable_schema = ON;
DROP TABLE payment_delivery_part;
ALTER TABLE payment_delivery_part_new RENAME TO payment_delivery_part;
PRAGMA writable_schema = OFF;
PRAGMA foreign_keys = ON;
DROP TRIGGER IF EXISTS t_payment_delivery_part_i;
CREATE TRIGGER t_payment_delivery_part_i