salix/db/routines/pbx/triggers/sip_afterUpdate.sql

14 lines
355 B
MySQL
Raw Normal View History

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `pbx`.`sip_afterUpdate`
AFTER UPDATE ON `sip`
FOR EACH ROW
BEGIN
IF !(OLD.extension <=> NEW.extension)
OR !(OLD.user_id <=> NEW.user_id) THEN
INSERT IGNORE INTO `account`.userSync (`name`)
SELECT `name` FROM `account`.`user`
WHERE id = NEW.user_id;
END IF;
END$$
DELIMITER ;