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

15 lines
309 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `account`.`user_beforeInsert`
BEFORE INSERT ON `user`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
CALL user_checkName(NEW.`name`);
IF NEW.nickname = '' THEN
SET NEW.nickname = NEW.`name`;
END IF;
END$$
DELIMITER ;