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

14 lines
313 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `pbx`.`sip_afterInsert`
AFTER INSERT ON `sip`
FOR EACH ROW
BEGIN
INSERT INTO sipReg
SET userId = NEW.user_id;
INSERT IGNORE INTO `account`.userSync (`name`)
SELECT `name` FROM `account`.`user`
WHERE id = NEW.user_id;
END$$
DELIMITER ;