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

14 lines
409 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmap_beforeUpdate`
BEFORE UPDATE ON `roadmap`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
IF NEW.tractorPlate IS NOT NULL THEN
CALL vehicle_checkNumberPlate(NEW.tractorPlate, NULL);
END IF;
IF NEW.trailerPlate IS NOT NULL THEN
CALL vehicle_checkNumberPlate(NEW.trailerPlate, NULL);
END IF;
END$$
DELIMITER ;