Files
dafuweng-saiadmin6.x/server/db/sa_system_role_add_dept_id.sql
2026-05-26 09:43:42 +08:00

11 lines
499 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 角色表按渠道隔离dept_id=0 为默认模板角色,各渠道拥有独立角色副本
ALTER TABLE `sa_system_role`
ADD COLUMN `dept_id` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '所属渠道ID0=默认模板' AFTER `id`,
ADD INDEX `idx_dept_id` (`dept_id`);
UPDATE `sa_system_role` SET `dept_id` = 0 WHERE `dept_id` IS NULL OR `id` > 1;
ALTER TABLE `sa_system_role` DROP INDEX `uk_slug`;
ALTER TABLE `sa_system_role` ADD UNIQUE KEY `uk_dept_code` (`dept_id`, `code`);