mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-25 09:37:30 +00:00
122 lines
5.0 KiB
SQL
122 lines
5.0 KiB
SQL
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 = 19 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 = 360 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
|
|
|
|
-- ----------------------------
|
|
-- Table structure for chat
|
|
-- ----------------------------
|
|
DROP TABLE IF EXISTS `chat`;
|
|
CREATE TABLE `chat` (
|
|
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
`chat_id` bigint(20) UNSIGNED NOT NULL,
|
|
`is_authorize` int(10) UNSIGNED NULL DEFAULT NULL,
|
|
`auth` int(10) NULL DEFAULT NULL,
|
|
PRIMARY KEY (`id`, `chat_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 = 19 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,
|
|
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
|
`time` date NULL DEFAULT NULL,
|
|
`last_time` date NULL DEFAULT NULL,
|
|
`status` int(11) 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 = 30 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 = 89 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Redundant;
|
|
|
|
-- ----------------------------
|
|
-- Table structure for sign
|
|
-- ----------------------------
|
|
DROP TABLE IF EXISTS `sign`;
|
|
CREATE TABLE `sign` (
|
|
`id` int(11) NOT NULL,
|
|
`user_id` int(11) NULL DEFAULT NULL,
|
|
`time` datetime(0) NULL DEFAULT NULL,
|
|
`last_time` datetime(0) NULL DEFAULT NULL,
|
|
`status` int(11) NULL DEFAULT NULL,
|
|
PRIMARY KEY (`id`) USING BTREE
|
|
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
|
|
|
|
-- ----------------------------
|
|
-- 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 = 51 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;
|