代码拉取完成,页面将自动刷新
-- create the databases
CREATE DATABASE IF NOT EXISTS bluebell;
USE bluebell;
-- create table
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) NOT NULL,
`username` varchar(64) COLLATE utf8_general_ci NOT NULL,
`password` varchar(64) COLLATE utf8_general_ci NOT NULL,
`email` varchar(64) COLLATE utf8_general_ci,
`gender` varchar(4) NOT NULL DEFAULT '0',
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `idx_username` (`username`) USING BTREE,
UNIQUE KEY `idx_user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- create table
DROP TABLE IF EXISTS `communtiy`;
CREATE TABLE `community` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`community_id` int(10) unsigned NOT NULL,
`community_name` varchar(128) COLLATE utf8mb4_general_ci NOT NULL,
`introduction` varchar(256) COLLATE utf8mb4_general_ci NOT NULL,
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `idx_community_id` (`community_id`),
UNIQUE key `idx_community_name` (`community_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- insert data
INSERT INTO `community` VALUES ('1', '1', 'Go', 'Golang', '2016-11-01 08:10:10', '2016-11-01 08:10:10');
INSERT INTO `community` VALUES ('2', '2', 'leetcode', '刷题刷题刷题', '2020-01-01 08:00:00', '2020-01-01 08:00:00');
INSERT INTO `community` VALUES ('3', '3', 'CS:GO', 'Rush B 。。。', '2018-08-07 08:30:00', '2018-08-07 08:30:00');
INSERT INTO `community` VALUES ('4', '4', 'LOL', '欢迎来到英雄联盟!', '2016-01-01 08:00:00', '2018-8-07 08:30:00');
-- create table
DROP TABLE IF EXISTS `post`;
CREATE TABLE `post` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`post_id` bigint(20) NOT NULL COMMENT '帖子id',
`title` varchar(128) COLLATE utf8mb4_general_ci NOT NULL COMMENT '标题',
`content` varchar(8192) COLLATE utf8mb4_general_ci NOT NULL COMMENT '内容',
`author_id` bigint(20) NOT NULL COMMENT '作者的用户id',
`community_id` bigint(20) NOT NULL COMMENT '所属社区',
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '帖子状态',
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `idx_post_id` (`post_id`),
KEY `idx_author_id` (`author_id`),
KEY `idx_community_id` (`community_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。