Ai
1 Star 4 Fork 0

StudentCWZ/ bluebell

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
init.sql 3.50 KB
一键复制 编辑 原始数据 按行查看 历史
StudentCWZ 提交于 2022-04-26 16:18 +08:00 . first commit
-- 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;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/studentcwz/bluebell.git
git@gitee.com:studentcwz/bluebell.git
studentcwz
bluebell
bluebell
master

搜索帮助