Spring security在MS-SQL下的初始化脚本

本文介绍了一种基于SQL的用户权限管理系统设计方案,包括用户表、权限表及组权限关联表等关键组件。通过创建表格定义了用户、权限及用户组的关系,并确保权限分配的一致性和唯一性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 -- create table users(  
 --     username nvarchar(50) not null primary key,  
 --     password nvarchar(50) not null,  
 --     enabled bit not null);  
 --create table authorities (  
--      username nvarchar(50) not null,  
--      authority nvarchar(50) not null,  
--      constraint fk_authorities_users foreign key(username) references users(username));  
--      create unique index ix_auth_username on authorities (username,authority);  
create table groups (  
  [id] [bigint] IDENTITY (0, 1) NOT NULL primary key,   
  group_name nvarchar(50) not null);  
create table group_authorities (  
  group_id bigint not null,   
  authority nvarchar(50) not null,   
  constraint fk_group_authorities_group foreign key(group_id) references groups(id));  
create table group_members (  
   [id] [bigint] IDENTITY (0, 1) NOT NULL primary key,   
  username nvarchar(50) not null,   
  group_id bigint not null,   
  constraint fk_group_members_group foreign key(group_id) references groups(id)); 

  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值