PaiGram/config/sql/tgpaimonbot.sql

122 lines
5.0 KiB
MySQL
Raw Normal View History

2022-05-29 16:36:02 +00:00
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
2022-06-13 07:57:42 +00:00
) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
2022-05-29 16:36:02 +00:00
-- ----------------------------
-- 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
2022-06-13 07:57:42 +00:00
) ENGINE = InnoDB AUTO_INCREMENT = 360 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
2022-05-29 16:36:02 +00:00
-- ----------------------------
2022-06-09 15:09:10 +00:00
-- Table structure for chat
2022-05-29 16:36:02 +00:00
-- ----------------------------
2022-06-09 15:09:10 +00:00
DROP TABLE IF EXISTS `chat`;
2022-06-13 07:57:42 +00:00
CREATE TABLE `chat` (
2022-05-29 16:36:02 +00:00
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
2022-06-09 15:09:10 +00:00
`chat_id` bigint(20) UNSIGNED NOT NULL,
2022-05-29 16:36:02 +00:00
`is_authorize` int(10) UNSIGNED NULL DEFAULT NULL,
`auth` int(10) NULL DEFAULT NULL,
2022-06-09 15:09:10 +00:00
PRIMARY KEY (`id`, `chat_id`) USING BTREE
2022-05-29 16:36:02 +00:00
) 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
2022-06-13 07:57:42 +00:00
) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
2022-05-29 16:36:02 +00:00
-- ----------------------------
-- Table structure for job
-- ----------------------------
DROP TABLE IF EXISTS `job`;
CREATE TABLE `job` (
`id` int(11) NOT NULL,
2022-06-13 07:57:42 +00:00
`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,
2022-05-29 16:36:02 +00:00
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
2022-06-13 07:57:42 +00:00
) ENGINE = InnoDB AUTO_INCREMENT = 30 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
2022-05-29 16:36:02 +00:00
-- ----------------------------
-- 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
2022-06-13 07:57:42 +00:00
) 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;
2022-05-29 16:36:02 +00:00
-- ----------------------------
-- 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
2022-06-13 07:57:42 +00:00
) ENGINE = InnoDB AUTO_INCREMENT = 51 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
2022-05-29 16:36:02 +00:00
-- ----------------------------
-- 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;