```
a. 只能使用手机号+验证码登录注册
b. 可以发布贴子
c. 可以互相关注
d. 可以对贴子发布评论
e. 可以对贴子的评论进行引用后再回复
```
# 关注表
CREATE TABLE Attention(
`id` int not null auto_increment comment '关注表id',
`user_id` int comment '用户id',
`followed_user_id` int comment '关注用户id',
`state` int(5) comment '100 已关注 101 删除关注',
`create_at` datetime DEFAULT CURRENT_TIMESTAMP,
`update_at` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(id),
index(user_id),
CONSTRAINT `attention_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `User` (`id`) ON DELETE CASCADE
);
# 评论消息表
CREATE TABLE Comment (
`id` int not null auto_increment comment '评论id',
`content` text comment '评论内容',
`article_id` int comment '帖子id',
`user_id` int comment '发布人id',
`state` int(5) comment '100 已发表 101 删除',
`superior_id` int comment '上级评论id',
`create_at` datetime DEFAULT CURRENT_TIMESTAMP,
`update_at` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(id),
index(article_id),
CONSTRAINT `comment_ibfk_1` FOREIGN KEY (`article_id`) REFERENCES `Article` (`id`) ON DELETE CASCADE
)ENGINE=INNODB DEFAULT CHARSET=utf8;
# 帖子表
CREATE TABLE Article (
`id` int not null auto_increment comment '帖子id',
`title` varchar(50) comment '帖子标题',
`user_id` int(11) comment '发布人id',
`state` int(5) comment '100 已发表 110 编辑 120 草稿 -101 删除',
`put_at` datetime comment '帖子发布时间',
`content` text comment '帖子内容',
`comment_num` int comment '评论数',
`create_at` datetime DEFAULT CURRENT_TIMESTAMP,
`update_at` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(id),
index(user_id),
CONSTRAINT `article_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `User` (`id`) ON DELETE CASCADE
)ENGINE=INNODB DEFAULT CHARSET=utf8;
# 用户表
CREATE TABLE User (
`id` int not null auto_increment,
`name` varchar(10),
`state` int(5) comment '100 启用 -101 注销',
`phone` varchar(15),
`create_at` datetime DEFAULT CURRENT_TIMESTAMP,
`update_at` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(id),
UNIQUE(phone, state)
)ENGINE=INNODB DEFAULT CHARSET=utf8;
# 验证码
CREATE TABLE AuthCode (
`id` int not null auto_increment,
`phone` varchar(15),
`code` varchar(5),
`state` int(5) comment '100 可用 -101 不可用',
`next_send_code` int comment '下次可发送短信验证码时间戳',
`create_at` datetime DEFAULT CURRENT_TIMESTAMP,
`update_at` datetime DEFAULT CURRENT_TIMESTAMP,
INDEX(phone),
PRIMARY KEY(id)
)ENGINE=INNODB DEFAULT CHARSET=utf8;