47 lines
1.0 KiB
MySQL
47 lines
1.0 KiB
MySQL
|
|
||
|
ALTER TABLE `account`.`role`
|
||
|
MODIFY COLUMN `hasLogin` tinyint(3) unsigned DEFAULT 1 NOT NULL;
|
||
|
|
||
|
ALTER TABLE `account`.`roleInherit`
|
||
|
ADD UNIQUE( `role`, `inheritsFrom`);
|
||
|
|
||
|
ALTER TABLE `account`.`roleInherit`
|
||
|
DROP PRIMARY KEY;
|
||
|
|
||
|
ALTER TABLE `account`.`roleInherit`
|
||
|
ADD `id` INT UNSIGNED NOT NULL AUTO_INCREMENT FIRST,
|
||
|
ADD PRIMARY KEY (`id`);
|
||
|
|
||
|
ALTER TABLE `account`.`mailAlias`
|
||
|
ADD `description` VARCHAR(255) NULL AFTER `alias`;
|
||
|
|
||
|
ALTER TABLE `account`.`mailAliasAccount`
|
||
|
ADD UNIQUE( `mailAlias`, `account`);
|
||
|
|
||
|
ALTER TABLE `account`.`mailAliasAccount`
|
||
|
DROP PRIMARY KEY;
|
||
|
|
||
|
ALTER TABLE `account`.`mailAliasAccount`
|
||
|
ADD `id` INT UNSIGNED NOT NULL AUTO_INCREMENT FIRST,
|
||
|
ADD PRIMARY KEY (`id`);
|
||
|
|
||
|
|
||
|
USE account;
|
||
|
|
||
|
DELIMITER $$
|
||
|
|
||
|
CREATE TRIGGER role_beforeInsert
|
||
|
BEFORE INSERT ON `role` FOR EACH ROW
|
||
|
BEGIN
|
||
|
CALL role_checkName(NEW.`name`);
|
||
|
END$$
|
||
|
|
||
|
CREATE TRIGGER role_beforeUpdate
|
||
|
BEFORE UPDATE ON `role` FOR EACH ROW
|
||
|
BEGIN
|
||
|
IF !(NEW.`name` <=> OLD.`name`) THEN
|
||
|
CALL role_checkName (NEW.`name`);
|
||
|
END IF;
|
||
|
END$$
|
||
|
|
||
|
DELIMITER ;
|