DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `account`.`user_afterUpdate` AFTER UPDATE ON `user` FOR EACH ROW BEGIN IF !(NEW.image <=> OLD.image) THEN CALL hedera.image_unref('user', OLD.image); CALL hedera.image_ref('user', NEW.image); END IF; INSERT IGNORE INTO userSync SET `name` = NEW.`name`; IF !(OLD.`name` <=> NEW.`name`) THEN INSERT IGNORE INTO userSync SET `name` = OLD.`name`; END IF; END$$ DELIMITER ;