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

12 lines
316 B
MySQL
Raw Normal View History

2024-08-22 15:02:59 +00:00
DELIMITER $$
2024-10-01 06:51:03 +00:00
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmap_beforeUpdate`
2024-08-22 15:02:59 +00:00
BEFORE UPDATE ON `roadmap`
FOR EACH ROW
BEGIN
IF NEW.driver1Fk IS NOT NULL THEN
SET NEW.driverName = (SELECT firstName FROM worker WHERE id = NEW.driver1Fk);
ELSE
SET NEW.driverName = NULL;
END IF;
END$$
DELIMITER ;