From c8da62d78ea19dbdaa15697e7f31dbd02474864d Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Thu, 9 Feb 2017 09:39:54 +0500 Subject: Add trigger on group deleting --- schema/changelog-3.10.xml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'schema') diff --git a/schema/changelog-3.10.xml b/schema/changelog-3.10.xml index 33f02880d..ad8c34668 100644 --- a/schema/changelog-3.10.xml +++ b/schema/changelog-3.10.xml @@ -34,11 +34,11 @@ - + - + @@ -75,6 +75,7 @@ + @@ -95,7 +96,14 @@ CREATE TRIGGER tg_users_delete ON users FOR DELETE AS BEGIN - DELETE FROM user_user WHERE managedUserId IN (SELECT deleted.id FROM deleted) + DELETE FROM user_user WHERE manageduserid IN (SELECT deleted.id FROM deleted) + END + + + CREATE TRIGGER tg_groups_delete + ON groups FOR DELETE + AS BEGIN + UPDATE groups SET groupid = NULL WHERE groupid IN (SELECT deleted.id FROM deleted) END -- cgit v1.2.3