mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-16 21:00:16 +00:00
108 lines
4.5 KiB
MySQL
108 lines
4.5 KiB
MySQL
|
SET NAMES utf8mb4;
|
||
|
SET FOREIGN_KEY_CHECKS = 0;
|
||
|
|
||
|
-- ----------------------------
|
||
|
-- Table structure for admin
|
||
|
-- ----------------------------
|
||
|
DROP TABLE IF EXISTS `admin`;
|
||
|
CREATE TABLE `admin` (
|
||
|
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
|
`user_id` bigint(20) UNSIGNED NOT NULL,
|
||
|
PRIMARY KEY (`id`) USING BTREE,
|
||
|
UNIQUE INDEX `user_id`(`user_id`) USING BTREE
|
||
|
) ENGINE = InnoDB AUTO_INCREMENT = 20 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
|
||
|
|
||
|
-- ----------------------------
|
||
|
-- Table structure for answer
|
||
|
-- ----------------------------
|
||
|
DROP TABLE IF EXISTS `answer`;
|
||
|
CREATE TABLE `answer` (
|
||
|
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
|
`question_id` int(11) UNSIGNED NULL DEFAULT NULL,
|
||
|
`is_correct` int(11) NULL DEFAULT NULL,
|
||
|
`answer` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||
|
PRIMARY KEY (`id`) USING BTREE,
|
||
|
INDEX `question_id`(`question_id`) USING BTREE,
|
||
|
CONSTRAINT `answer_ibfk_1` FOREIGN KEY (`question_id`) REFERENCES `question` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
|
||
|
) ENGINE = InnoDB AUTO_INCREMENT = 355 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
|
||
|
|
||
|
-- ----------------------------
|
||
|
-- Table structure for char
|
||
|
-- ----------------------------
|
||
|
DROP TABLE IF EXISTS `char`;
|
||
|
CREATE TABLE `char` (
|
||
|
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
|
`char_id` bigint(20) UNSIGNED NOT NULL,
|
||
|
`is_authorize` int(10) UNSIGNED NULL DEFAULT NULL,
|
||
|
`auth` int(10) NULL DEFAULT NULL,
|
||
|
PRIMARY KEY (`id`, `char_id`) USING BTREE
|
||
|
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
|
||
|
|
||
|
-- ----------------------------
|
||
|
-- Table structure for hoyoverse_cookie
|
||
|
-- ----------------------------
|
||
|
DROP TABLE IF EXISTS `hoyoverse_cookie`;
|
||
|
CREATE TABLE `hoyoverse_cookie` (
|
||
|
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
|
`user_id` bigint(20) NOT NULL,
|
||
|
`cookie` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||
|
PRIMARY KEY (`id`, `user_id`) USING BTREE,
|
||
|
UNIQUE INDEX `user_id`(`user_id`) USING BTREE
|
||
|
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
|
||
|
|
||
|
-- ----------------------------
|
||
|
-- Table structure for job
|
||
|
-- ----------------------------
|
||
|
DROP TABLE IF EXISTS `job`;
|
||
|
CREATE TABLE `job` (
|
||
|
`id` int(11) NOT NULL,
|
||
|
`job` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||
|
`job_status` int(11) NULL DEFAULT NULL,
|
||
|
`last_time` datetime(0) NULL DEFAULT NULL,
|
||
|
PRIMARY KEY (`id`) USING BTREE
|
||
|
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
|
||
|
|
||
|
-- ----------------------------
|
||
|
-- Table structure for mihoyo_cookie
|
||
|
-- ----------------------------
|
||
|
DROP TABLE IF EXISTS `mihoyo_cookie`;
|
||
|
CREATE TABLE `mihoyo_cookie` (
|
||
|
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
|
`user_id` bigint(20) NOT NULL,
|
||
|
`cookie` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||
|
PRIMARY KEY (`id`, `user_id`) USING BTREE,
|
||
|
UNIQUE INDEX `user_id`(`user_id`) USING BTREE
|
||
|
) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
|
||
|
-- ----------------------------
|
||
|
-- Table structure for question
|
||
|
-- ----------------------------
|
||
|
DROP TABLE IF EXISTS `question`;
|
||
|
CREATE TABLE `question` (
|
||
|
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
|
`question` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||
|
PRIMARY KEY (`id`) USING BTREE
|
||
|
) ENGINE = InnoDB AUTO_INCREMENT = 88 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Redundant;
|
||
|
|
||
|
-- ----------------------------
|
||
|
-- Table structure for user
|
||
|
-- ----------------------------
|
||
|
DROP TABLE IF EXISTS `user`;
|
||
|
CREATE TABLE `user` (
|
||
|
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
|
`user_id` bigint(20) NOT NULL,
|
||
|
`mihoyo_game_uid` int(11) NULL DEFAULT NULL,
|
||
|
`hoyoverse_game_uid` int(11) NULL DEFAULT NULL,
|
||
|
`service` int(11) NULL DEFAULT NULL,
|
||
|
PRIMARY KEY (`id`, `user_id`) USING BTREE,
|
||
|
UNIQUE INDEX `user_id`(`user_id`) USING BTREE
|
||
|
) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||
|
|
||
|
-- ----------------------------
|
||
|
-- View structure for quiz
|
||
|
-- ----------------------------
|
||
|
DROP VIEW IF EXISTS `quiz`;
|
||
|
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `quiz` AS select `question`.`id` AS `question_id`,`question`.`question` AS `question`,`answer`.`answer` AS `answer`,`answer`.`is_correct` AS `is_correct` from (`question` join `answer` on((`question`.`id` = `answer`.`question_id`)));
|
||
|
|
||
|
SET FOREIGN_KEY_CHECKS = 1;
|