123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- /*==============================================================*/
- /* DBMS name: MySQL 5.0 */
- /* Created on: 2019/3/10 10:03:43 */
- /*==============================================================*/
- drop table if exists action_bars;
- drop table if exists group_users;
- drop table if exists groups;
- drop table if exists user_action_bars;
- drop table if exists user_roles;
- drop table if exists users;
- /*==============================================================*/
- /* Table: action_bars */
- /*==============================================================*/
- create table action_bars
- (
- id int not null auto_increment,
- parent int default 0 comment '该层菜单的上级菜单',
- level int default 1 comment '该级菜单是第几级菜单',
- name varchar(128),
- description varchar(255),
- icon varchar(255),
- link_type char(32) comment '定义link的含义,可以是跳转,可以是发起请求',
- link char(255),
- status char(32) default 'normal' comment '状态表,可能用户编辑了这个菜单,但是没有编辑完,所以只是存了一份草稿',
- created_at timestamp default CURRENT_TIMESTAMP,
- updated_at timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- created_user_id int,
- updated_user_id int,
- is_del bool default false,
- primary key (id)
- );
- alter table action_bars comment '下拉菜单';
- /*==============================================================*/
- /* Table: group_users */
- /*==============================================================*/
- create table group_users
- (
- id int not null auto_increment,
- group_id int,
- user_id int,
- status char(32) default 'normal',
- created_at timestamp default CURRENT_TIMESTAMP,
- updated_at timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- created_user_id int,
- updated_user_id int,
- is_del bool,
- primary key (id)
- );
- alter table group_users comment '用户组和用户的关联表';
- /*==============================================================*/
- /* Table: groups */
- /*==============================================================*/
- create table groups
- (
- id int not null auto_increment,
- name varchar(128),
- description varchar(255),
- icon varchar(255),
- status char(32) default 'normal',
- created_at timestamp default CURRENT_TIMESTAMP,
- updated_at timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- created_user_id int,
- updated_user_id int,
- is_del bool default false,
- primary key (id)
- );
- alter table groups comment '用户组';
- /*==============================================================*/
- /* Table: user_action_bars */
- /*==============================================================*/
- create table user_action_bars
- (
- id int not null auto_increment comment '用户id',
- user_id int,
- bar_id int comment '用户有权限的下拉列表,多个如1,2,3,4用逗号隔开',
- status char(32) default 'normal' comment '角色是否生效的状态',
- created_at timestamp default CURRENT_TIMESTAMP comment '创建时间',
- updated_at timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment '最后更新时间',
- created_user_id int,
- updated_user_id int,
- is_del bool default false comment '删除标志',
- primary key (id)
- );
- alter table user_action_bars comment '下拉菜单权限表';
- /*==============================================================*/
- /* Table: user_roles */
- /*==============================================================*/
- create table user_roles
- (
- id int not null auto_increment comment '用户id',
- user_id int,
- role int comment '用户权限,为管理员或者普通用户,取值为1,2,4,8,16...',
- status char(32) default 'normal',
- created_at timestamp default CURRENT_TIMESTAMP,
- updated_at timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- created_user_id int,
- updated_user_id int,
- is_del bool default false,
- primary key (id)
- );
- alter table user_roles comment '用户权限表';
- /*==============================================================*/
- /* Table: users */
- /*==============================================================*/
- create table users
- (
- id int not null auto_increment,
- username varchar(128) not null comment '用户名',
- password varchar(128) not null comment '用户密码',
- nickname varchar(255) comment '用户昵称',
- icon varchar(255),
- tel char(16) comment '用户电话',
- email char(64) comment '用户邮箱',
- created_at timestamp default CURRENT_TIMESTAMP comment '创建时间',
- updated_at timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment '最后更新时间',
- created_user_id int,
- updated_user_id int,
- is_del bool default false comment '删除标志',
- primary key (id)
- );
- alter table users comment '用户表';
|