15 lines
309 B
MySQL
15 lines
309 B
MySQL
|
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 ;
|