当前位置:网站首页>Project: combing the database table
Project: combing the database table
2022-08-02 15:34:00 【Caviar :P】
A total of 4 tables---The function of sending private messages is not implemented, so there are only four tables: user table, login credential table, post table, and comment table.
1.user user table
CREATE TABLE `user` (`id` int(11) NOT NULL AUTO_INCREMENT,`username` varchar(50) DEFAULT NULL,`password` varchar(50) DEFAULT NULL,`salt` varchar(50) DEFAULT NULL,`email` varchar(100) DEFAULT NULL,`type` int(11) DEFAULT NULL COMMENT '0-normal user; 1-super administrator; 2-moderator;',`status` int(11) DEFAULT NULL COMMENT '0-inactive; 1-active;',`activation_code` varchar(100) DEFAULT NULL,`header_url` varchar(200) DEFAULT NULL,`create_time` timestamp NULL DEFAULT NULL,PRIMARY KEY (`id`),KEY `index_username` (`username`(20)),KEY `index_email` (`email`(20))) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8;- usernameusername
- passwordUser password
- The salt is used for encryption
- email user's mailbox
- type user type 0 means ordinary user 1 means super administrator 2 means moderator
- status 0 means inactive 1 means active
- activation_codeActivation code
- header_url avatar address
- create_time user registration time
2.discuss_post post table
CREATE TABLE `discuss_post` (`id` int(11) NOT NULL AUTO_INCREMENT,`user_id` varchar(45) DEFAULT NULL,`title` varchar(100) DEFAULT NULL,`content` text,`type` int(11) DEFAULT NULL COMMENT '0-normal; 1-top;',`status` int(11) DEFAULT NULL COMMENT '0-normal; 1-essence; 2-blackout;',`create_time` timestamp NULL DEFAULT NULL,`comment_count` int(11) DEFAULT NULL,`score` double DEFAULT NULL,PRIMARY KEY (`id`),KEY `index_user_id` (`user_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;- user_id indicates the id of the poster
- title means title
- content indicates the content of the post
- type means post type 0 means normal post 1 means top post
- status means the status of the post 0 means normal post 1 means elite post 2 means blocked post
- create_time indicates the date of the post
- comment_count indicates the number of comments on the post, which is a redundant parameter to improve query efficiency
3.login_ticket login credentials table
CREATE TABLE `login_ticket` (`id` int(11) NOT NULL AUTO_INCREMENT,`user_id` int(11) NOT NULL,`ticket` varchar(45) NOT NULL,`status` int(11) DEFAULT '0' COMMENT '0-valid; 1-invalid;',`expired` timestamp NOT NULL,PRIMARY KEY (`id`),KEY `index_ticket` (`ticket`(20))) ENGINE=InnoDB DEFAULT CHARSET=utf8;Login credential table, the purpose is to protect the security of user data, used to detect whether the user is logged in, and then obtain the login credentials through the interceptor to create a User object when the server is started
- user_iduserid
- ticket number
- status credential status 0 means valid credential 1 means invalid credential
- expired is used to check if the credential has expired
4.comment comment form
CREATE TABLE `comment` (`id` int(11) NOT NULL AUTO_INCREMENT,`user_id` int(11) DEFAULT NULL,`entity_type` int(11) DEFAULT NULL,`entity_id` int(11) DEFAULT NULL,`target_id` int(11) DEFAULT NULL,`content` text,`status` int(11) DEFAULT NULL,`create_time` timestamp NULL DEFAULT NULL,PRIMARY KEY (`id`),KEY `index_user_id` (`user_id`) /*!80000 INVISIBLE */,KEY `index_entity_id` (`entity_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;- user_id is used to indicate the id of the user who posted this comment
- entity_type indicates the type of comments: 1 means comments in response to posts 2 means comments in response to comments
- entity_id indicates the post id of the comment
- target_id indicates the id of the reply object when replying. If id=0, it means this is a comment replying to a post. If id!=0, it means this is a comment replying to target_id user
- contentComment content
- status comments with a status of 0 for helpful comments and 1 for deleted comments
- When the create_time comment was posted
5.message message table
CREATE TABLE `message` (`id` int(11) NOT NULL AUTO_INCREMENT,`from_id` int(11) DEFAULT NULL,`to_id` int(11) DEFAULT NULL,`conversation_id` varchar(45) NOT NULL,`content` text,`status` int(11) DEFAULT NULL COMMENT '0-unread;1-read;2-delete;',`create_time` timestamp NULL DEFAULT NULL,PRIMARY KEY (`id`),KEY `index_from_id` (`from_id`),KEY `index_to_id` (`to_id`),KEY `index_conversation_id` (`conversation_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;- from_id is the id of the person who sent the message
- to_id is the id of the person sending the target
- conversation_id is also a redundant field to facilitate query, the rules are spliced with from_id and to_id with _ and the smaller is in the front and the larger is in the back
- content message content
- The status of the status message 0 means unread 1 means read 2 means deleted
- The time when the create_time message was sent
边栏推荐
- Mapreduce环境详细搭建和案例实现
- 5. Transaction management
- How to add a one-key shutdown option to the right-click menu in Windows 11
- 模板系列-并查集
- 2.登录退出,登录状态检查,验证码
- Win11声卡驱动如何更新?Win11声卡驱动更新方法
- 如何用硬币模拟1/3的概率,以及任意概率?
- Compilation error D8021: Invalid numeric argument '/Wextra' cl command line error d8021 invalid numeric argument '/Wextra'
- Win11 computer off for a period of time without operating network how to solve
- Use tencent cloud builds a personal blog
猜你喜欢

网络安全抓包

6.统一记录日志

yolov5官方代码解读——前向传播

How to solve Win11 without local users and groups

golang之GMP调度模型

推开机电的大门《电路》(一):电压,电流,参考方向

Yolov5 official code reading - prior to transmission

STM32LL library use - SPI communication

Win10安装了固态硬盘还是有明显卡顿怎么办?

Installation and configuration of Spark and related ecological components - quick recall
随机推荐
cmake配置libtorch报错Failed to compute shorthash for libnvrtc.so
专硕与学硕
MATLAB绘图函数fplot详解
倍增和稀疏表
使用libcurl将Opencv Mat的图像上传到文件服务器,基于post请求和ftp协议两种方法
质数相关问题-小记
Knapsack Problem - Dynamic Programming - Theory
Detailed explanation of MATLAB drawing function plot
Redis的线程模型
mysql学习总结 & 索引
轻量化AlphaPose
Win10电脑需要安装杀毒软件吗?
Use libcurl to upload the image of Opencv Mat to the file server, based on two methods of post request and ftp protocol
MATLAB绘图函数ezplot入门详解
IPV4和IPV6是什么?
flink+sklearn——使用jpmml实现flink上的机器学习模型部署
[System Design and Implementation] Flink-based distracted driving prediction and data analysis system
In-depth understanding of Golang's Map
How to solve Win11 without local users and groups
深入理解Golang之Map