salix/db/install/changes/8-clientAfterUpdate.sql

19 lines
425 B
MySQL
Raw Normal View History

DROP TRIGGER IF EXISTS vn2008.ClientesAfterUpdate;
USE vn2008;
DELIMITER $$
$$
CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`ClientesAfterUpdate`
AFTER UPDATE ON `Clientes`
FOR EACH ROW
BEGIN
IF NEW.default_address AND (NEW.default_address != OLD.default_address) THEN
UPDATE Consignatarios SET predeterminada = FALSE
WHERE Id_cliente = NEW.Id_cliente;
END IF;
END$$
DELIMITER ;
USE vn;