当前位置:网站首页>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
边栏推荐
- Actual combat Meituan Nuxt +Vue family bucket, server-side rendering, mailbox verification, passport authentication service, map API reference, mongodb, redis and other technical points
- Win10 computer can't read U disk?Don't recognize U disk how to solve?
- KiCad Common Shortcuts
- casbin模型
- 7.Redis
- win10怎么设置不睡眠熄屏?win10设置永不睡眠的方法
- 【STM32学习1】基础知识与概念明晰
- General code for pytorch model to libtorch and onnx format
- 基于矩阵计算的线性回归分析方程中系数的估计
- cmake配置libtorch报错Failed to compute shorthash for libnvrtc.so
猜你喜欢

How to update Win11 sound card driver?Win11 sound card driver update method

Win10上帝模式干嘛的?Win10怎么开启上帝模式?

第二十六章:二维数组

How to add a one-key shutdown option to the right-click menu in Windows 11

Mysql connection error solution

In-depth understanding of Golang's Map

win10 system update error code 0x80244022 how to do

【STM32学习1】基础知识与概念明晰

Win7 encounters an error and cannot boot into the desktop normally, how to solve it?

队列与栈
随机推荐
MATLAB绘图函数ezplot入门详解
Installation and configuration of Spark and related ecological components - quick recall
MATLAB绘图函数plot详解
使用 腾讯云搭建一个个人博客
STM32LL库——USART中断接收不定长信息
2.登录退出,登录状态检查,验证码
yolov5官方代码解读——前向传播
二叉树创建之层次法入门详解
Win10无法连接打印机怎么办?不能使用打印机的解决方法
二叉排序树与 set、map
Based on the matrix calculation in the linear regression equation of the coefficient estimates
深入理解Golang之Map
奇技淫巧-位运算
win10 system update error code 0x80244022 how to do
Based on the least squares linear regression equation coefficient estimation
Software Testing Basics (Back)
Win11 computer off for a period of time without operating network how to solve
动态规划理论篇
Use tencent cloud builds a personal blog
软件测试基础知识(背)