12 lines
318 B
MySQL
12 lines
318 B
MySQL
|
DELIMITER $$
|
||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`roadmap_beforeUpdate`
|
||
|
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 ;
|