-- ----------------------------
|
-- 用户和角色关联表 用户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');
|