salix/db/routines/vn/triggers/sharingCart_beforeDelete.sql

12 lines
341 B
MySQL
Raw Permalink Normal View History

DELIMITER $$
2024-08-20 08:06:10 +00:00
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`sharingCart_beforeDelete`
BEFORE DELETE ON `sharingCart`
FOR EACH ROW
BEGIN
DELETE sc FROM sharingCartDaily sc
WHERE sc.dated BETWEEN OLD.started AND OLD.ended AND
sc.ownerFk = OLD.workerFk AND
sc.substituteFk = OLD.workerSubstitute;
END$$
DELIMITER ;