salix/db/routines/account/triggers/account_afterDelete.sql

16 lines
396 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `account`.`account_afterDelete`
AFTER DELETE ON `account`
FOR EACH ROW
BEGIN
INSERT INTO userLog
SET `action` = 'delete',
`changedModel` = 'Account',
`changedModelId` = OLD.id,
`userFk` = account.myUser_getId();
INSERT IGNORE INTO userSync (`name`)
SELECT `name` FROM `user` WHERE id = OLD.id;
END$$
DELIMITER ;