DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `account`.`user_afterDelete`
	AFTER DELETE ON `user`
	FOR EACH ROW
BEGIN
	INSERT INTO userLog
		SET `action` = 'delete',
			`changedModel` = 'User',
			`changedModelId` = OLD.id,
			`userFk` = account.myUser_getId();

	CALL hedera.image_unref('user', OLD.image);

	INSERT IGNORE INTO userSync SET `name` = OLD.`name`;
END$$
DELIMITER ;
