16 lines
396 B
MySQL
16 lines
396 B
MySQL
|
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 ;
|