salix/db/routines/account/triggers/role_beforeUpdate.sql

12 lines
286 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `account`.`role_beforeUpdate`
BEFORE UPDATE ON `role`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
IF !(NEW.`name` <=> OLD.`name`) THEN
CALL role_checkName (NEW.`name`);
END IF;
END$$
DELIMITER ;