salix/services/db/install/changes/1.2-CHECK/07-ticketLogAfterInsert.sql

18 lines
513 B
MySQL
Raw Normal View History

2018-10-30 07:35:17 +00:00
DROP TRIGGER IF EXISTS `vn`.`ticketLog_AFTER_INSERT`;
DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`ticketLog_AFTER_INSERT` AFTER INSERT ON `ticketLog` FOR EACH ROW
BEGIN
DECLARE vActionId INT DEFAULT 84;
DECLARE vWorkerFk INT;
SELECT id INTO vWorkerFk
FROM worker w
WHERE w.userFk = NEW.userFk;
INSERT INTO vn2008.Tickets_dits(idaccion_dits,Id_Trabajador,Id_Ticket,value_old,value_new)
VALUES (vActionId, vWorkerFk, NEW.originFk, NULL, NULL);
END$$
DELIMITER ;