-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathddl.sql
49 lines (42 loc) · 2.62 KB
/
ddl.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
-- 创建库
create database if not exists my_db;
-- 切换库
use my_db;
-- 用户表
create table if not exists user
(
id bigint auto_increment comment 'id' primary key,
userName varchar(256) null comment '用户昵称',
userAccount varchar(256) not null comment '账号',
userAvatar varchar(1024) null comment '用户头像',
gender tinyint null comment '性别',
userRole varchar(256) default 'user' not null comment '用户角色:user / admin',
userPassword varchar(512) not null comment '密码',
createTime datetime default CURRENT_TIMESTAMP not null comment '创建时间',
updateTime datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
isDelete tinyint default 0 not null comment '是否删除',
constraint uni_userAccount
unique (userAccount)
) comment '用户';
-- 帖子表
create table if not exists post
(
id bigint auto_increment comment 'id' primary key,
age int comment '年龄',
gender tinyint default 0 not null comment '性别(0-男, 1-女)',
education varchar(512) null comment '学历',
place varchar(512) null comment '地点',
job varchar(512) null comment '职业',
contact varchar(512) null comment '联系方式',
loveExp varchar(512) null comment '感情经历',
content text null comment '内容(个人介绍)',
photo varchar(1024) null comment '照片地址',
reviewStatus int default 0 not null comment '状态(0-待审核, 1-通过, 2-拒绝)',
reviewMessage varchar(512) null comment '审核信息',
viewNum int not null default 0 comment '浏览数',
thumbNum int not null default 0 comment '点赞数',
userId bigint not null comment '创建用户 id',
createTime datetime default CURRENT_TIMESTAMP not null comment '创建时间',
updateTime datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
isDelete tinyint default 0 not null comment '是否删除'
) comment '帖子';