一个图文分享APP的数据库概念设计
时间: 2024-06-01 16:10:34 浏览: 16
以下是一个图文分享APP的数据库概念设计:
1. 用户表(User)
字段名 类型 说明
id int 用户ID
username varchar(50) 用户名
password varchar(50) 密码
email varchar(50) 邮箱
phone varchar(20) 手机号
avatar varchar(100) 头像URL
gender tinyint(1) 性别(0:未知,1:男,2:女)
birthday date 生日
created_at datetime 注册时间
updated_at datetime 更新时间
2. 文章表(Post)
字段名 类型 说明
id int 文章ID
user_id int 用户ID
title varchar(100) 标题
content text 内容
image_url varchar(100) 图片URL
created_at datetime 发布时间
updated_at datetime 更新时间
3. 评论表(Comment)
字段名 类型 说明
id int 评论ID
user_id int 用户ID
post_id int 文章ID
content text 评论内容
created_at datetime 评论时间
updated_at datetime 更新时间
4. 点赞表(Like)
字段名 类型 说明
id int 点赞ID
user_id int 用户ID
post_id int 文章ID
created_at datetime 点赞时间
updated_at datetime 更新时间
5. 关注表(Follow)
字段名 类型 说明
id int 关注ID
follower_id int 关注者ID
followee_id int 被关注者ID
created_at datetime 关注时间
updated_at datetime 更新时间
6. 标签表(Tag)
字段名 类型 说明
id int 标签ID
name varchar(50) 标签名称
created_at datetime 创建时间
updated_at datetime 更新时间
7. 文章-标签关联表(Post_Tag)
字段名 类型 说明
id int 关联ID
post_id int 文章ID
tag_id int 标签ID
created_at datetime 创建时间
updated_at datetime 更新时间
8. 消息表(Notification)
字段名 类型 说明
id int 消息ID
user_id int 用户ID
type tinyint(1) 消息类型(1:系统消息,2:点赞消息,3:评论消息,4:关注消息)
content text 消息内容
created_at datetime 创建时间
updated_at datetime 更新时间
以上是一个图文分享APP的数据库概念设计,可以根据实际需求进行调整和扩展。
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)