2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticket_beforeDelete`
|
2024-01-15 11:31:03 +00:00
|
|
|
BEFORE DELETE ON `ticket`
|
|
|
|
FOR EACH ROW
|
|
|
|
BEGIN
|
|
|
|
INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`)
|
|
|
|
SELECT r.id
|
|
|
|
FROM vn.route r
|
|
|
|
WHERE r.isOk = FALSE
|
|
|
|
AND r.id = OLD.routeFk
|
2024-11-28 16:29:39 +00:00
|
|
|
AND r.dated >= util.VN_CURDATE()
|
2024-01-15 11:31:03 +00:00
|
|
|
GROUP BY r.id;
|
|
|
|
|
|
|
|
DELETE FROM sale WHERE ticketFk = OLD.id;
|
|
|
|
|
|
|
|
DELETE FROM ticketDms WHERE ticketFk = OLD.id;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|