DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `hedera`.`link_afterUpdate` AFTER UPDATE ON `link` FOR EACH ROW BEGIN IF !(NEW.image <=> OLD.image) THEN CALL image_unref('link', OLD.image); CALL image_ref('link', NEW.image); END IF; END$$ DELIMITER ;