From eda7f40fefc4717e5cebc40f13a03cbb18ab492c Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 20 Dec 2019 00:42:59 +0000 Subject: [PATCH] Reinstall trigger that prevents group zero from being deleted. Signed-off-by: DL6ER --- advanced/Scripts/database_migration/gravity/7_to_8.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/advanced/Scripts/database_migration/gravity/7_to_8.sql b/advanced/Scripts/database_migration/gravity/7_to_8.sql index 0e58408e..412475da 100644 --- a/advanced/Scripts/database_migration/gravity/7_to_8.sql +++ b/advanced/Scripts/database_migration/gravity/7_to_8.sql @@ -21,6 +21,11 @@ CREATE TRIGGER tr_group_update AFTER UPDATE ON "group" UPDATE "group" SET date_modified = (cast(strftime('%s', 'now') as int)) WHERE id = NEW.id; END; +CREATE TRIGGER tr_group_zero AFTER DELETE ON "group" + BEGIN + INSERT OR IGNORE INTO "group" (id,enabled,name) VALUES (0,1,'Unassociated'); + END; + INSERT OR IGNORE INTO "group" (id,enabled,name,description) SELECT id,enabled,name,description FROM "group__"; DROP TABLE "group__";