ref #5858 feat: dispatchers_after[Insert|Update|Delete]

This commit is contained in:
Javier Segarra 2023-11-22 09:27:08 +01:00
parent 1b60cd33d5
commit f00b264daa
1 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,47 @@
DROP TRIGGER IF EXISTS `vn`.`zoneIncluded_afterInsert`;
USE `vn`;
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneIncluded_afterInsert`
AFTER INSERT ON `zoneIncluded`
FOR EACH ROW
BEGIN
INSERT INTO zoneLog
SET `action` = 'insert',
`changedModel` = 'zoneIncluded',
`changedModelId` = OLD.zoneFk,
`userFk` = account.myUser_getId();
END$$
DELIMITER ;
DROP TRIGGER IF EXISTS `vn`.`zoneIncluded_afterUpdate`;
USE `vn`;
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneIncluded_afterUpdate`
AFTER UPDATE ON `zoneIncluded`
FOR EACH ROW
BEGIN
INSERT INTO zoneLog
SET `action` = 'update',
`changedModel` = 'zoneIncluded',
`changedModelId` = OLD.zoneFk,
`userFk` = account.myUser_getId();
END$$
DELIMITER ;
-- DROP TRIGGER IF EXISTS `vn`.`zoneIncluded_afterDelete`;
-- USE `vn`;
-- DELIMITER $$
-- CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneIncluded_afterDelete`
-- AFTER DELETE ON `zoneIncluded`
-- FOR EACH ROW
-- BEGIN
-- INSERT INTO zoneLog
-- SET `action` = 'delete',
-- `changedModel` = 'zoneIncluded',
-- `changedModelId` = OLD.zoneFk,
-- `userFk` = account.myUser_getId();
-- END$$
-- DELIMITER ;