Skip to content

Commit

Permalink
fix: 完善部分数据库表的唯一索引
Browse files Browse the repository at this point in the history
1.sys_menu 增加 uk_title_parent_id 唯一索引
2.sys_dept 增加 uk_name_parent_id 唯一索引
3.sys_role 增加 uk_name、uk_code 唯一索引
4.sys_user 增加 uk_phone 唯一索引
  • Loading branch information
Charles7c committed Aug 26, 2023
1 parent 85043d8 commit 88d6118
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ CREATE TABLE IF NOT EXISTS `sys_menu` (
`update_user` bigint(20) UNSIGNED DEFAULT NULL COMMENT '修改人',
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_title_parent_id`(`title`, `parent_id`) USING BTREE,
INDEX `idx_parent_id`(`parent_id`) USING BTREE,
INDEX `idx_create_user`(`create_user`) USING BTREE,
INDEX `idx_update_user`(`update_user`) USING BTREE
Expand All @@ -40,6 +41,7 @@ CREATE TABLE IF NOT EXISTS `sys_dept` (
`update_user` bigint(20) UNSIGNED DEFAULT NULL COMMENT '修改人',
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_name_parent_id`(`name`, `parent_id`) USING BTREE,
INDEX `idx_parent_id`(`parent_id`) USING BTREE,
INDEX `idx_create_user`(`create_user`) USING BTREE,
INDEX `idx_update_user`(`update_user`) USING BTREE
Expand All @@ -59,6 +61,8 @@ CREATE TABLE IF NOT EXISTS `sys_role` (
`update_user` bigint(20) UNSIGNED DEFAULT NULL COMMENT '修改人',
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_name`(`name`) USING BTREE,
UNIQUE INDEX `uk_code`(`code`) USING BTREE,
INDEX `idx_create_user`(`create_user`) USING BTREE,
INDEX `idx_update_user`(`update_user`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色表';
Expand Down Expand Up @@ -96,6 +100,7 @@ CREATE TABLE IF NOT EXISTS `sys_user` (
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_username`(`username`) USING BTREE,
UNIQUE INDEX `uk_email`(`email`) USING BTREE,
UNIQUE INDEX `uk_phone`(`phone`) USING BTREE,
INDEX `idx_dept_id`(`dept_id`) USING BTREE,
INDEX `idx_create_user`(`create_user`) USING BTREE,
INDEX `idx_update_user`(`update_user`) USING BTREE
Expand Down

0 comments on commit 88d6118

Please sign in to comment.