/* Navicat Premium Data Transfer Source Server : 华为云 Source Server Type : MySQL Source Server Version : 80200 (8.2.0) Source Host : 116.204.21.236:3306 Source Schema : onlineoj Target Server Type : MySQL Target Server Version : 80200 (8.2.0) File Encoding : 65001 Date: 30/11/2023 13:19:41 */ # 先创建数据库 # CREATE DATABASE XJ_OJ; # USE XJ_OJ; # 如果是MySql8.0以上的版本遇到报错可以尝试将 utf8_general_ci替换为utf8mb4_0900_ai_ci # 同时将utf8替换为utf8mb4 SET NAMES utf8; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for article -- ---------------------------- DROP TABLE IF EXISTS `article`; CREATE TABLE `article` ( `id` int NOT NULL AUTO_INCREMENT COMMENT 'id', `author_id` int NOT NULL COMMENT '作者id', `title` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '标题', `content` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '正文', `time` datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '发布时间', `read_num` int NULL DEFAULT 0 COMMENT '阅读量', `star_num` int NULL DEFAULT 0 COMMENT '点赞量', `comment_num` int NULL DEFAULT 0 COMMENT '点赞量', `problem_id` int NULL DEFAULT NULL COMMENT '题目id', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of article -- ---------------------------- -- ---------------------------- -- Table structure for code -- ---------------------------- DROP TABLE IF EXISTS `code`; CREATE TABLE `code` ( `id` int NOT NULL AUTO_INCREMENT COMMENT '代码id', `user_id` int NOT NULL, `problem_id` int NOT NULL, `code_path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `create_time` datetime NULL DEFAULT NULL, `language` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of code -- ---------------------------- -- ---------------------------- -- Table structure for contest -- ---------------------------- DROP TABLE IF EXISTS `contest`; CREATE TABLE `contest` ( `id` int NOT NULL AUTO_INCREMENT, `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `start_time` datetime NULL DEFAULT NULL, `end_time` datetime NULL DEFAULT NULL, `num` int NULL DEFAULT NULL, `status` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of contest -- ---------------------------- -- ---------------------------- -- Table structure for contest_problem -- ---------------------------- DROP TABLE IF EXISTS `contest_problem`; CREATE TABLE `contest_problem` ( `id` int NOT NULL AUTO_INCREMENT, `contest_id` int NOT NULL, `problem_id` int NOT NULL, `submit_num` int NOT NULL DEFAULT 0 COMMENT '提交数', `solved_num` int NOT NULL DEFAULT 0 COMMENT '通过数', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of contest_problem -- ---------------------------- -- ---------------------------- -- Table structure for contest_user -- ---------------------------- DROP TABLE IF EXISTS `contest_user`; CREATE TABLE `contest_user` ( `id` int NOT NULL AUTO_INCREMENT, `contest_id` int NOT NULL, `user_id` int NOT NULL, `submit_num` int NOT NULL DEFAULT 0, `solved_num` int NOT NULL DEFAULT 0, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of contest_user -- ---------------------------- -- ---------------------------- -- Table structure for evaluation -- ---------------------------- DROP TABLE IF EXISTS `evaluation`; CREATE TABLE `evaluation` ( `id` int NOT NULL AUTO_INCREMENT, `user_id` int NOT NULL, `problem_id` int NOT NULL, `create_time` datetime NOT NULL, `language` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `passed_test_case_num` int NOT NULL DEFAULT 0, `all_test_case_num` int NOT NULL DEFAULT 0, `error` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL, `is_passed` int NOT NULL DEFAULT 0, `status` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of evaluation -- ---------------------------- -- ---------------------------- -- Table structure for file -- ---------------------------- DROP TABLE IF EXISTS `file`; CREATE TABLE `file` ( `id` int NOT NULL, `original_filename` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `new_filename` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `date` datetime NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of file -- ---------------------------- -- ---------------------------- -- Table structure for problem -- ---------------------------- DROP TABLE IF EXISTS `problem`; CREATE TABLE `problem` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT '题目id', `title` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '题目标题', `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '题目描述', `input` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '输入', `output` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '输出', `hint` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '提示', `source` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '来源', `create_time` datetime NOT NULL COMMENT '创建时间', `time_limit` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '时间限制(ms)', `memory_limit` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '内存限制(kb)', `difficulty` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '难度', `user_id` bigint NULL DEFAULT NULL COMMENT '上传用户', `submit_num` int NULL DEFAULT 0 COMMENT '提交次数', `solved_num` int NULL DEFAULT NULL COMMENT '解决次数', `describe_input` varchar(255) CHARACTER SET utf16le COLLATE utf16le_general_ci NULL DEFAULT NULL, `describe_output` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of problem -- ---------------------------- -- ---------------------------- -- Table structure for solution -- ---------------------------- DROP TABLE IF EXISTS `solution`; CREATE TABLE `solution` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', `user_id` bigint NOT NULL COMMENT '用户id', `problem_id` bigint NOT NULL COMMENT '题目id', `run_time` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '运行使用时间(ms)', `memory` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '运行内存', `language_id` int NULL DEFAULT NULL COMMENT '语言id', `submit_time` datetime NULL DEFAULT NULL COMMENT '提交时间', `result` varchar(999) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '运行结果', `contest_id` int NULL DEFAULT NULL COMMENT '所属竞赛id', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of solution -- ---------------------------- -- ---------------------------- -- Table structure for test_case -- ---------------------------- DROP TABLE IF EXISTS `test_case`; CREATE TABLE `test_case` ( `id` int NOT NULL AUTO_INCREMENT, `problem_id` int NOT NULL, `input` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `output` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of test_case -- ---------------------------- -- ---------------------------- -- Table structure for user -- ---------------------------- DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户编号', `username` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '用户名', `password` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '密码', `sex` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '性别', `introduction` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '个人简介', `photo` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '头像链接', `email` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '邮箱', `submit_num` bigint NULL DEFAULT 0 COMMENT '提交次数', `solved_num` bigint NULL DEFAULT 0 COMMENT '解决的题数', `register_time` datetime NULL DEFAULT NULL COMMENT '注册时间', `access_time` datetime NULL DEFAULT NULL COMMENT '最后登录时间', `ip` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '登录的ip地址', `school` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '学校', `language` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT '0' COMMENT '默认使用的语言', `is_admin` int NULL DEFAULT 0, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of user -- ---------------------------- INSERT INTO `user` VALUES (1, 'weiyuexin', 'root', '男', '你好,我来自XJ', '18331361148', '3022422894@qq.com', 0, 0, '2023-02-12 20:09:44', '2023-02-24 20:09:49', NULL, '河南大学', '0', 0); SET FOREIGN_KEY_CHECKS = 1;