-- 角色表新增字段
ALTER TABLE `admin_role` 
ADD COLUMN `code` varchar(50) DEFAULT '' COMMENT '角色编码' AFTER `name`,
ADD COLUMN `is_default` tinyint(1) DEFAULT 0 COMMENT '是否默认角色: 0否 1是' AFTER `permissions`,
ADD COLUMN `sort` int(11) DEFAULT 0 COMMENT '排序' AFTER `is_default`,
ADD INDEX `idx_sort` (`sort`);

-- 更新现有角色数据
UPDATE `admin_role` SET `code` = 'ADMIN', `is_default` = 1, `sort` = 1 WHERE `id` = 1;
UPDATE `admin_role` SET `code` = 'EDITOR', `sort` = 2 WHERE `id` = 2;

-- 新增审核员角色
INSERT INTO `admin_role` (`name`, `code`, `description`, `permissions`, `is_default`, `sort`, `create_by`) VALUES
('审核员', 'AUDITOR', '内容审核权限', '["content:article:view","content:article:audit"]', 0, 3, 0);
