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

12 lines
343 B
MySQL
Raw Normal View History

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`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 ;