From b08a9271926213cb3c3acf7db1ac9b0cc0a4b6df Mon Sep 17 00:00:00 2001 From: Tom Teichler <tom.teichler@teckids.org> Date: Sat, 17 Dec 2022 13:09:28 +0000 Subject: [PATCH] Fix sql migration --- aleksis/core/migrations/0046_add_room_model.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/aleksis/core/migrations/0046_add_room_model.py b/aleksis/core/migrations/0046_add_room_model.py index b8206f64e..ad1c70ca3 100644 --- a/aleksis/core/migrations/0046_add_room_model.py +++ b/aleksis/core/migrations/0046_add_room_model.py @@ -47,8 +47,7 @@ class Migration(migrations.Migration): migrations.RunSQL( """ -- Use a temporary, empty source table in case Chronos is not installed - CREATE TEMPORARY TABLE IF NOT EXISTS chronos_room (LIKE core_room); - INSERT INTO core_room SELECT * FROM chronos_room; + DO $$BEGIN INSERT INTO core_room SELECT * FROM chronos_room; EXCEPTION WHEN undefined_table THEN NULL; END$$; """ ), ] -- GitLab