当前位置:网站首页>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
边栏推荐
- STM32LL库使用——SPI通信
- Win11系统找不到dll文件怎么修复
- What should I do if Windows 10 cannot connect to the printer?Solutions for not using the printer
- MATLAB制作简易小动画入门详解
- [System Design and Implementation] Flink-based distracted driving prediction and data analysis system
- Win10电脑需要安装杀毒软件吗?
- 二叉树创建之层次法入门详解
- 网络安全抓包
- Open the door to electricity "Circuit" (3): Talk about different resistance and conductance
- Codeforces Round #624 (Div. 3)
猜你喜欢
Based on the least squares linear regression equation coefficient estimation
动态规划理论篇
What are IPV4 and IPV6?
STM32LL library use - SPI communication
What is Win10 God Mode for?How to enable God Mode in Windows 10?
二叉排序树与 set、map
【STM32学习1】基础知识与概念明晰
1.开发社区首页,注册
MATLAB图形加标注的基本方法入门简介
Based on the matrix calculation in the linear regression equation of the coefficient estimates
随机推荐
背包问题-动态规划-理论篇
二叉树创建之层次法入门详解
Mysql连接错误解决
win11一直弹出用户账户控制怎么解决
[System Design and Implementation] Flink-based distracted driving prediction and data analysis system
开心一下,9/28名场面合集
Yolov5 official code reading - prior to transmission
Flink + sklearn - use JPMML implement flink deployment on machine learning model
一篇文章彻底理解Redis的持久化:RDB、AOF
win10任务栏不合并图标如何设置
jest测试,组件测试
奇技淫巧-位运算
Lightweight AlphaPose
jest test, component test
Happy, 9/28 scene collection
Win10 computer can't read U disk?Don't recognize U disk how to solve?
MATLAB图形加标注的基本方法入门简介
General syntax and usage instructions of SQL (picture and text)
STM32LL库使用——SPI通信
How to set the win10 taskbar does not merge icons