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

17 lines
439 B
MySQL
Raw Permalink Normal View History

DELIMITER $$
2024-08-20 08:06:10 +00:00
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`province_afterUpdate`
AFTER UPDATE ON `province`
FOR EACH ROW
BEGIN
IF !(OLD.autonomyFk <=> NEW.autonomyFk) THEN
CALL zoneGeo_setParent(NEW.geoFk,
(SELECT geoFk FROM autonomy WHERE id = NEW.autonomyFk));
END IF;
IF !(OLD.`name` <=> NEW.`name`) THEN
UPDATE zoneGeo SET `name` = NEW.`name`
WHERE id = NEW.geoFk;
END IF;
END$$
DELIMITER ;