18 lines
513 B
SQL
18 lines
513 B
SQL
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 ;
|