Fixed bug in migration where NS bindings were lost

The migration would recreate the reminders table but by deferring the foreign keys, the entries in the reminder_services table were removed (ON DELETE CASCADE) so no reminder had a notification service selected. Fixed that by completely turning off and on the foreign key system instead of simply deferring them.
This commit is contained in:
CasVT
2025-08-29 16:16:16 +02:00
parent 8e6224fb27
commit 7456561a3a

View File

@@ -343,8 +343,8 @@ class MigrateAddCronScheduleColumn(DBMigrator):
# V12 -> V13
get_db().executescript("""
PRAGMA foreign_keys = OFF;
BEGIN TRANSACTION;
PRAGMA defer_foreign_keys = ON;
CREATE TEMPORARY TABLE temp_reminders_13 AS
SELECT * FROM reminders;
@@ -380,4 +380,5 @@ class MigrateAddCronScheduleColumn(DBMigrator):
FROM temp_reminders_13;
COMMIT;
PRAGMA foreign_keys = ON;
""")