2024-07-22 09:52:42 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmapStop_beforeUpdate`
|
2024-07-22 09:52:42 +00:00
|
|
|
BEFORE UPDATE ON `roadmapStop`
|
|
|
|
FOR EACH ROW
|
|
|
|
BEGIN
|
2025-01-21 13:03:50 +00:00
|
|
|
SET NEW.editorFk = account.myUser_getId();
|
2024-07-22 09:52:42 +00:00
|
|
|
SET NEW.description = UCASE(NEW.description);
|
2025-01-22 11:40:58 +00:00
|
|
|
IF (NOT (NEW.roadmapFk <=> OLD.roadmapFk) AND NEW.roadmapFk IS NOT NULL)
|
|
|
|
OR (NOT (NEW.eta <=> OLD.eta) AND NEW.eta IS NOT NULL) THEN
|
|
|
|
|
|
|
|
IF NEW.eta < (SELECT etd FROM roadmap WHERE id = NEW.roadmapFk) THEN
|
|
|
|
CALL util.throw('Departure time can not be after arrival time');
|
|
|
|
END IF;
|
|
|
|
END IF;
|
2024-07-22 09:52:42 +00:00
|
|
|
END$$
|
|
|
|
DELIMITER ;
|