|
1 | 1 | -- ---------------------------- |
2 | 2 | -- 系统用户表 |
3 | 3 | -- ---------------------------- |
4 | | -create table security_user |
| 4 | +CREATE TABLE IF NOT EXISTS security_user |
5 | 5 | ( |
6 | | - id bigint unsigned auto_increment, |
7 | | - username varchar(50) not null comment '用户名', |
8 | | - password varchar(100) not null comment '密码', |
9 | | - nick_name varchar(50) not null comment '昵称', |
10 | | - enable_flag tinyint unsigned not null comment '是否启用', |
11 | | - token char(36) comment 'token', |
12 | | - token_time datetime comment 'token 时间', |
13 | | - create_time datetime default current_timestamp, |
14 | | - update_time datetime default null on update current_timestamp, |
15 | | - primary key (id), |
16 | | - constraint uk_username unique (username) |
17 | | -) engine = InnoDB |
18 | | - default charset = utf8 |
19 | | - comment '系统用户表'; |
| 6 | + id BIGINT UNSIGNED AUTO_INCREMENT, |
| 7 | + username VARCHAR(50) NOT NULL COMMENT '用户名', |
| 8 | + password VARCHAR(100) NOT NULL COMMENT '密码', |
| 9 | + nick_name VARCHAR(50) NOT NULL COMMENT '昵称', |
| 10 | + enable_flag TINYINT UNSIGNED NOT NULL COMMENT '是否启用', |
| 11 | + token CHAR(36) COMMENT 'token', |
| 12 | + token_time DATETIME COMMENT 'token 时间', |
| 13 | + create_time DATETIME DEFAULT CURRENT_TIMESTAMP, |
| 14 | + update_time DATETIME DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, |
| 15 | + PRIMARY KEY (id), |
| 16 | + CONSTRAINT uk_username UNIQUE (username) |
| 17 | +) ENGINE = InnoDB |
| 18 | + DEFAULT CHARSET = utf8 |
| 19 | + COMMENT '系统用户表'; |
20 | 20 | -- ---------------------------- |
21 | 21 | -- 系统角色表 |
22 | 22 | -- ---------------------------- |
23 | | -create table security_role |
| 23 | +CREATE TABLE IF NOT EXISTS security_role |
24 | 24 | ( |
25 | | - id bigint unsigned auto_increment, |
26 | | - code varchar(50) not null comment '角色代码', |
27 | | - name varchar(50) not null comment '角色名称', |
28 | | - description varchar(100) comment '角色描述', |
29 | | - create_time datetime default current_timestamp, |
30 | | - update_time datetime default null on update current_timestamp, |
31 | | - primary key (id), |
32 | | - constraint uk_code unique (code) |
33 | | -) engine = InnoDB |
34 | | - default charset = utf8 |
35 | | - comment '系统角色表'; |
| 25 | + id BIGINT UNSIGNED AUTO_INCREMENT, |
| 26 | + code VARCHAR(50) NOT NULL COMMENT '角色代码', |
| 27 | + name VARCHAR(50) NOT NULL COMMENT '角色名称', |
| 28 | + description VARCHAR(100) COMMENT '角色描述', |
| 29 | + create_time DATETIME DEFAULT CURRENT_TIMESTAMP, |
| 30 | + update_time DATETIME DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, |
| 31 | + PRIMARY KEY (id), |
| 32 | + CONSTRAINT uk_code UNIQUE (code) |
| 33 | +) ENGINE = InnoDB |
| 34 | + DEFAULT CHARSET = utf8 |
| 35 | + COMMENT '系统角色表'; |
36 | 36 | -- ---------------------------- |
37 | 37 | -- 系统权限表 |
38 | 38 | -- ---------------------------- |
39 | | -create table security_api |
| 39 | +CREATE TABLE IF NOT EXISTS security_api |
40 | 40 | ( |
41 | | - id bigint unsigned auto_increment, |
42 | | - url varchar(50) not null comment '接口路径', |
43 | | - description varchar(100) comment '接口描述', |
44 | | - create_time datetime default current_timestamp, |
45 | | - update_time datetime default null on update current_timestamp, |
46 | | - primary key (id), |
47 | | - constraint uk_url unique (url) |
48 | | -) engine = InnoDB |
49 | | - default charset = utf8 |
50 | | - comment '系统权限表'; |
| 41 | + id BIGINT UNSIGNED AUTO_INCREMENT, |
| 42 | + url VARCHAR(50) NOT NULL COMMENT '接口路径', |
| 43 | + description VARCHAR(100) COMMENT '接口描述', |
| 44 | + create_time DATETIME DEFAULT CURRENT_TIMESTAMP, |
| 45 | + update_time DATETIME DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, |
| 46 | + PRIMARY KEY (id), |
| 47 | + CONSTRAINT uk_url UNIQUE (url) |
| 48 | +) ENGINE = InnoDB |
| 49 | + DEFAULT CHARSET = utf8 |
| 50 | + COMMENT '系统权限表'; |
51 | 51 | -- ---------------------------- |
52 | 52 | -- 角色用户关系表 |
53 | 53 | -- ---------------------------- |
54 | | -create table security_role_user |
| 54 | +CREATE TABLE IF NOT EXISTS security_role_user |
55 | 55 | ( |
56 | | - role_id bigint unsigned not null, |
57 | | - user_id bigint unsigned not null |
58 | | -) engine = InnoDB |
59 | | - default charset = utf8 |
60 | | - comment '角色用户关系表'; |
| 56 | + role_id BIGINT UNSIGNED NOT NULL, |
| 57 | + user_id BIGINT UNSIGNED NOT NULL |
| 58 | +) ENGINE = InnoDB |
| 59 | + DEFAULT CHARSET = utf8 |
| 60 | + COMMENT '角色用户关系表'; |
61 | 61 | -- ---------------------------- |
62 | 62 | -- 角色权限关系表 |
63 | 63 | -- ---------------------------- |
64 | | -create table security_role_api |
| 64 | +CREATE TABLE IF NOT EXISTS security_role_api |
65 | 65 | ( |
66 | | - role_id bigint unsigned not null, |
67 | | - api_id bigint unsigned not null |
68 | | -) engine = InnoDB |
69 | | - default charset = utf8 |
70 | | - comment '角色权限关系表'; |
| 66 | + role_id BIGINT UNSIGNED NOT NULL, |
| 67 | + api_id BIGINT UNSIGNED NOT NULL |
| 68 | +) ENGINE = InnoDB |
| 69 | + DEFAULT CHARSET = utf8 |
| 70 | + COMMENT '角色权限关系表'; |
0 commit comments