chenhj
8 天以前 2db123a855bd3bb2182714cd15a9446987b0e7ae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
-- ----------------------------
-- 用户和角色关联表  用户N-1角色
-- ----------------------------
drop table if exists sys_user_role;
 
-- 创建表
create table sys_user_role
(
    user_id bigint not null,       -- 用户ID
    role_id bigint not null,       -- 角色ID
    primary key (user_id, role_id) -- 复合主键
);
 
comment on table sys_user_role is '用户和角色关联表';
comment on column sys_user_role.user_id is '用户ID';
comment on column sys_user_role.role_id is '角色ID';
 
-- 初始化-用户和角色关联表数据
insert into sys_user_role (user_id, role_id)
values ('1', '1'),
       ('2', '2');