/*
Navicat MySQL Data Transfer

Source Server         : 本机
Source Server Version : 50715
Source Host           : localhost:3306
Source Database       : ks

Target Server Type    : MYSQL
Target Server Version : 50715
File Encoding         : 65001

Date: 2021-11-22 11:04:30
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for `auth_group`
-- ----------------------------
DROP TABLE IF EXISTS `auth_group`;
CREATE TABLE `auth_group` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(150) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of auth_group
-- ----------------------------

-- ----------------------------
-- Table structure for `auth_group_permissions`
-- ----------------------------
DROP TABLE IF EXISTS `auth_group_permissions`;
CREATE TABLE `auth_group_permissions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `group_id` int(11) NOT NULL,
  `permission_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `auth_group_permissions_group_id_permission_id_0cd325b0_uniq` (`group_id`,`permission_id`),
  KEY `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm` (`permission_id`),
  CONSTRAINT `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`),
  CONSTRAINT `auth_group_permissions_group_id_b120cbf9_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of auth_group_permissions
-- ----------------------------

-- ----------------------------
-- Table structure for `auth_permission`
-- ----------------------------
DROP TABLE IF EXISTS `auth_permission`;
CREATE TABLE `auth_permission` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `content_type_id` int(11) NOT NULL,
  `codename` varchar(100) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `auth_permission_content_type_id_codename_01ab375a_uniq` (`content_type_id`,`codename`),
  CONSTRAINT `auth_permission_content_type_id_2f476e4b_fk_django_co` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of auth_permission
-- ----------------------------
INSERT INTO `auth_permission` VALUES ('1', 'Can add permission', '1', 'add_permission');
INSERT INTO `auth_permission` VALUES ('2', 'Can change permission', '1', 'change_permission');
INSERT INTO `auth_permission` VALUES ('3', 'Can delete permission', '1', 'delete_permission');
INSERT INTO `auth_permission` VALUES ('4', 'Can view permission', '1', 'view_permission');
INSERT INTO `auth_permission` VALUES ('5', 'Can add group', '2', 'add_group');
INSERT INTO `auth_permission` VALUES ('6', 'Can change group', '2', 'change_group');
INSERT INTO `auth_permission` VALUES ('7', 'Can delete group', '2', 'delete_group');
INSERT INTO `auth_permission` VALUES ('8', 'Can view group', '2', 'view_group');
INSERT INTO `auth_permission` VALUES ('9', 'Can add content type', '3', 'add_contenttype');
INSERT INTO `auth_permission` VALUES ('10', 'Can change content type', '3', 'change_contenttype');
INSERT INTO `auth_permission` VALUES ('11', 'Can delete content type', '3', 'delete_contenttype');
INSERT INTO `auth_permission` VALUES ('12', 'Can view content type', '3', 'view_contenttype');
INSERT INTO `auth_permission` VALUES ('13', 'Can add session', '4', 'add_session');
INSERT INTO `auth_permission` VALUES ('14', 'Can change session', '4', 'change_session');
INSERT INTO `auth_permission` VALUES ('15', 'Can delete session', '4', 'delete_session');
INSERT INTO `auth_permission` VALUES ('16', 'Can view session', '4', 'view_session');
INSERT INTO `auth_permission` VALUES ('17', '浏览', '8', 'view_department');
INSERT INTO `auth_permission` VALUES ('18', '添加', '8', 'add_department');
INSERT INTO `auth_permission` VALUES ('19', '修改', '8', 'edit_department');
INSERT INTO `auth_permission` VALUES ('20', '删除', '8', 'delete_department');
INSERT INTO `auth_permission` VALUES ('21', '浏览', '9', 'view_user');
INSERT INTO `auth_permission` VALUES ('22', '添加', '9', 'add_user');
INSERT INTO `auth_permission` VALUES ('23', '修改', '9', 'edit_user');
INSERT INTO `auth_permission` VALUES ('24', '删除', '9', 'delete_user');

-- ----------------------------
-- Table structure for `base_chapter`
-- ----------------------------
DROP TABLE IF EXISTS `base_chapter`;
CREATE TABLE `base_chapter` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `notes` varchar(500) DEFAULT NULL,
  `delete` tinyint(1) NOT NULL,
  `subject_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `base_chapter_subject_id_0e4d03c0_fk_base_subject_id` (`subject_id`),
  CONSTRAINT `base_chapter_subject_id_0e4d03c0_fk_base_subject_id` FOREIGN KEY (`subject_id`) REFERENCES `base_subject` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of base_chapter
-- ----------------------------

-- ----------------------------
-- Table structure for `base_subject`
-- ----------------------------
DROP TABLE IF EXISTS `base_subject`;
CREATE TABLE `base_subject` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `notes` varchar(500) DEFAULT NULL,
  `delete` tinyint(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of base_subject
-- ----------------------------

-- ----------------------------
-- Table structure for `django_content_type`
-- ----------------------------
DROP TABLE IF EXISTS `django_content_type`;
CREATE TABLE `django_content_type` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `app_label` varchar(100) NOT NULL,
  `model` varchar(100) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `django_content_type_app_label_model_76bd3d3b_uniq` (`app_label`,`model`)
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of django_content_type
-- ----------------------------
INSERT INTO `django_content_type` VALUES ('2', 'auth', 'group');
INSERT INTO `django_content_type` VALUES ('1', 'auth', 'permission');
INSERT INTO `django_content_type` VALUES ('3', 'contenttypes', 'contenttype');
INSERT INTO `django_content_type` VALUES ('23', 'errorbook', 'errorbook');
INSERT INTO `django_content_type` VALUES ('12', 'exam', 'exam');
INSERT INTO `django_content_type` VALUES ('13', 'exam', 'examanswerfilllog');
INSERT INTO `django_content_type` VALUES ('14', 'exam', 'examanswerlog');
INSERT INTO `django_content_type` VALUES ('15', 'exam', 'examansweroptionlog');
INSERT INTO `django_content_type` VALUES ('16', 'exam', 'examlog');
INSERT INTO `django_content_type` VALUES ('17', 'exampaper', 'exampaper');
INSERT INTO `django_content_type` VALUES ('18', 'exampaper', 'exampaperdetail');
INSERT INTO `django_content_type` VALUES ('19', 'examquestion', 'examquestion');
INSERT INTO `django_content_type` VALUES ('20', 'examquestion', 'examquestionfeedback');
INSERT INTO `django_content_type` VALUES ('22', 'examquestion', 'examquestionfill');
INSERT INTO `django_content_type` VALUES ('21', 'examquestion', 'examquestionoption');
INSERT INTO `django_content_type` VALUES ('7', 'foundation', 'chapter');
INSERT INTO `django_content_type` VALUES ('6', 'foundation', 'subject');
INSERT INTO `django_content_type` VALUES ('10', 'knowledge', 'knowledgebase');
INSERT INTO `django_content_type` VALUES ('11', 'knowledge', 'knowledgebasefeedback');
INSERT INTO `django_content_type` VALUES ('24', 'practiselog', 'practiseanswerfilllog');
INSERT INTO `django_content_type` VALUES ('25', 'practiselog', 'practiseanswerlog');
INSERT INTO `django_content_type` VALUES ('26', 'practiselog', 'practiseansweroptionlog');
INSERT INTO `django_content_type` VALUES ('27', 'practiselog', 'practiselog');
INSERT INTO `django_content_type` VALUES ('4', 'sessions', 'session');
INSERT INTO `django_content_type` VALUES ('8', 'staff', 'department');
INSERT INTO `django_content_type` VALUES ('9', 'staff', 'user');
INSERT INTO `django_content_type` VALUES ('5', 'system', 'syslog');

-- ----------------------------
-- Table structure for `django_migrations`
-- ----------------------------
DROP TABLE IF EXISTS `django_migrations`;
CREATE TABLE `django_migrations` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `app` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `applied` datetime(6) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of django_migrations
-- ----------------------------
INSERT INTO `django_migrations` VALUES ('1', 'contenttypes', '0001_initial', '2021-11-22 11:02:49.353778');
INSERT INTO `django_migrations` VALUES ('2', 'contenttypes', '0002_remove_content_type_name', '2021-11-22 11:02:49.447159');
INSERT INTO `django_migrations` VALUES ('3', 'auth', '0001_initial', '2021-11-22 11:02:49.552288');
INSERT INTO `django_migrations` VALUES ('4', 'auth', '0002_alter_permission_name_max_length', '2021-11-22 11:02:49.804353');
INSERT INTO `django_migrations` VALUES ('5', 'auth', '0003_alter_user_email_max_length', '2021-11-22 11:02:49.812353');
INSERT INTO `django_migrations` VALUES ('6', 'auth', '0004_alter_user_username_opts', '2021-11-22 11:02:49.821354');
INSERT INTO `django_migrations` VALUES ('7', 'auth', '0005_alter_user_last_login_null', '2021-11-22 11:02:49.828353');
INSERT INTO `django_migrations` VALUES ('8', 'auth', '0006_require_contenttypes_0002', '2021-11-22 11:02:49.831355');
INSERT INTO `django_migrations` VALUES ('9', 'auth', '0007_alter_validators_add_error_messages', '2021-11-22 11:02:49.838354');
INSERT INTO `django_migrations` VALUES ('10', 'auth', '0008_alter_user_username_max_length', '2021-11-22 11:02:49.845354');
INSERT INTO `django_migrations` VALUES ('11', 'auth', '0009_alter_user_last_name_max_length', '2021-11-22 11:02:49.853354');
INSERT INTO `django_migrations` VALUES ('12', 'auth', '0010_alter_group_name_max_length', '2021-11-22 11:02:49.910354');
INSERT INTO `django_migrations` VALUES ('13', 'auth', '0011_update_proxy_permissions', '2021-11-22 11:02:49.919353');
INSERT INTO `django_migrations` VALUES ('14', 'staff', '0001_initial', '2021-11-22 11:02:50.086353');
INSERT INTO `django_migrations` VALUES ('15', 'examquestion', '0001_initial', '2021-11-22 11:02:50.550353');
INSERT INTO `django_migrations` VALUES ('16', 'exampaper', '0001_initial', '2021-11-22 11:02:50.750352');
INSERT INTO `django_migrations` VALUES ('17', 'exam', '0001_initial', '2021-11-22 11:02:50.959352');
INSERT INTO `django_migrations` VALUES ('18', 'exam', '0002_examlog_exampaper', '2021-11-22 11:02:51.133905');
INSERT INTO `django_migrations` VALUES ('19', 'errorbook', '0001_initial', '2021-11-22 11:02:51.218662');
INSERT INTO `django_migrations` VALUES ('20', 'errorbook', '0002_auto_20211122_1037', '2021-11-22 11:02:51.359028');
INSERT INTO `django_migrations` VALUES ('21', 'foundation', '0001_initial', '2021-11-22 11:02:51.573027');
INSERT INTO `django_migrations` VALUES ('22', 'exampaper', '0002_exampaperdetail_question', '2021-11-22 11:02:51.679028');
INSERT INTO `django_migrations` VALUES ('23', 'exam', '0003_auto_20211122_1037', '2021-11-22 11:02:52.282053');
INSERT INTO `django_migrations` VALUES ('24', 'exampaper', '0003_auto_20211122_1037', '2021-11-22 11:02:52.869101');
INSERT INTO `django_migrations` VALUES ('25', 'examquestion', '0002_auto_20211122_1037', '2021-11-22 11:02:53.328330');
INSERT INTO `django_migrations` VALUES ('26', 'knowledge', '0001_initial', '2021-11-22 11:02:53.658249');
INSERT INTO `django_migrations` VALUES ('27', 'knowledge', '0002_auto_20211122_1037', '2021-11-22 11:02:53.967124');
INSERT INTO `django_migrations` VALUES ('28', 'practiselog', '0001_initial', '2021-11-22 11:02:54.428180');
INSERT INTO `django_migrations` VALUES ('29', 'practiselog', '0002_auto_20211122_1037', '2021-11-22 11:02:55.001445');
INSERT INTO `django_migrations` VALUES ('30', 'sessions', '0001_initial', '2021-11-22 11:02:55.518403');
INSERT INTO `django_migrations` VALUES ('31', 'system', '0001_initial', '2021-11-22 11:02:55.595400');

-- ----------------------------
-- Table structure for `django_session`
-- ----------------------------
DROP TABLE IF EXISTS `django_session`;
CREATE TABLE `django_session` (
  `session_key` varchar(40) NOT NULL,
  `session_data` longtext NOT NULL,
  `expire_date` datetime(6) NOT NULL,
  PRIMARY KEY (`session_key`),
  KEY `django_session_expire_date_a5c62663` (`expire_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of django_session
-- ----------------------------

-- ----------------------------
-- Table structure for `exam`
-- ----------------------------
DROP TABLE IF EXISTS `exam`;
CREATE TABLE `exam` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(200) NOT NULL,
  `type` smallint(5) unsigned DEFAULT NULL,
  `duration` int(11) NOT NULL,
  `exam_time` datetime(6) NOT NULL,
  `exam_end_time` datetime(6) DEFAULT NULL,
  `desc` longtext,
  `examinee_count` int(11) NOT NULL,
  `create_time` datetime(6) NOT NULL,
  `delete` tinyint(1) NOT NULL,
  `create_user_id` int(11) NOT NULL,
  `exampaper_id` int(11) DEFAULT NULL,
  `subject_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `exam_create_user_id_5ba8a4b9_fk_staff_user_id` (`create_user_id`),
  KEY `exam_exampaper_id_3b69f262_fk_exam_paper_id` (`exampaper_id`),
  KEY `exam_subject_id_3be84281_fk_base_subject_id` (`subject_id`),
  CONSTRAINT `exam_create_user_id_5ba8a4b9_fk_staff_user_id` FOREIGN KEY (`create_user_id`) REFERENCES `staff_user` (`id`),
  CONSTRAINT `exam_exampaper_id_3b69f262_fk_exam_paper_id` FOREIGN KEY (`exampaper_id`) REFERENCES `exam_paper` (`id`),
  CONSTRAINT `exam_subject_id_3be84281_fk_base_subject_id` FOREIGN KEY (`subject_id`) REFERENCES `base_subject` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of exam
-- ----------------------------

-- ----------------------------
-- Table structure for `exam_answer_fill_log`
-- ----------------------------
DROP TABLE IF EXISTS `exam_answer_fill_log`;
CREATE TABLE `exam_answer_fill_log` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `content` longtext NOT NULL,
  `order` int(11) NOT NULL,
  `main_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `exam_answer_fill_log_main_id_9b91f404_fk_exam_answer_log_id` (`main_id`),
  CONSTRAINT `exam_answer_fill_log_main_id_9b91f404_fk_exam_answer_log_id` FOREIGN KEY (`main_id`) REFERENCES `exam_answer_log` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of exam_answer_fill_log
-- ----------------------------

-- ----------------------------
-- Table structure for `exam_answer_log`
-- ----------------------------
DROP TABLE IF EXISTS `exam_answer_log`;
CREATE TABLE `exam_answer_log` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `status` smallint(5) unsigned NOT NULL,
  `detail_id` int(11) NOT NULL,
  `main_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `exam_answer_log_detail_id_63d3c2ee_fk_exam_paper_detail_id` (`detail_id`),
  KEY `exam_answer_log_main_id_41972038_fk_exam_log_id` (`main_id`),
  CONSTRAINT `exam_answer_log_detail_id_63d3c2ee_fk_exam_paper_detail_id` FOREIGN KEY (`detail_id`) REFERENCES `exam_paper_detail` (`id`),
  CONSTRAINT `exam_answer_log_main_id_41972038_fk_exam_log_id` FOREIGN KEY (`main_id`) REFERENCES `exam_log` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of exam_answer_log
-- ----------------------------

-- ----------------------------
-- Table structure for `exam_answer_option_log`
-- ----------------------------
DROP TABLE IF EXISTS `exam_answer_option_log`;
CREATE TABLE `exam_answer_option_log` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `main_id` int(11) NOT NULL,
  `option_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `exam_answer_option_log_main_id_e04537f3_fk_exam_answer_log_id` (`main_id`),
  KEY `exam_answer_option_l_option_id_3d0b0602_fk_exam_ques` (`option_id`),
  CONSTRAINT `exam_answer_option_l_option_id_3d0b0602_fk_exam_ques` FOREIGN KEY (`option_id`) REFERENCES `exam_question_option` (`id`),
  CONSTRAINT `exam_answer_option_log_main_id_e04537f3_fk_exam_answer_log_id` FOREIGN KEY (`main_id`) REFERENCES `exam_answer_log` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of exam_answer_option_log
-- ----------------------------

-- ----------------------------
-- Table structure for `exam_log`
-- ----------------------------
DROP TABLE IF EXISTS `exam_log`;
CREATE TABLE `exam_log` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` smallint(5) unsigned NOT NULL,
  `scores` int(11) DEFAULT NULL,
  `rank` int(11) DEFAULT NULL,
  `use_time` int(11) DEFAULT NULL,
  `exam_time` datetime(6) DEFAULT NULL,
  `submit_time` datetime(6) DEFAULT NULL,
  `single_answer_scores` int(11) NOT NULL,
  `multiple_answer_scores` int(11) NOT NULL,
  `fill_answer_scores` int(11) NOT NULL,
  `judgment_answer_scores` int(11) NOT NULL,
  `single_answer_count` int(11) NOT NULL,
  `multiple_answer_count` int(11) NOT NULL,
  `fill_answer_count` int(11) NOT NULL,
  `judgment_answer_count` int(11) NOT NULL,
  `delete` tinyint(1) NOT NULL,
  `exam_id` int(11) DEFAULT NULL,
  `exampaper_id` int(11) DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `exam_log_exam_id_0e9f5769_fk_exam_id` (`exam_id`),
  KEY `exam_log_exampaper_id_1020fb7e_fk_exam_paper_id` (`exampaper_id`),
  KEY `exam_log_user_id_2208d647_fk_staff_user_id` (`user_id`),
  CONSTRAINT `exam_log_exam_id_0e9f5769_fk_exam_id` FOREIGN KEY (`exam_id`) REFERENCES `exam` (`id`),
  CONSTRAINT `exam_log_exampaper_id_1020fb7e_fk_exam_paper_id` FOREIGN KEY (`exampaper_id`) REFERENCES `exam_paper` (`id`),
  CONSTRAINT `exam_log_user_id_2208d647_fk_staff_user_id` FOREIGN KEY (`user_id`) REFERENCES `staff_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of exam_log
-- ----------------------------

-- ----------------------------
-- Table structure for `exam_paper`
-- ----------------------------
DROP TABLE IF EXISTS `exam_paper`;
CREATE TABLE `exam_paper` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(200) NOT NULL,
  `type` smallint(5) unsigned NOT NULL,
  `passline` int(11) NOT NULL,
  `desc` longtext,
  `single_simple_count` int(11) NOT NULL,
  `multiple_simple_count` int(11) NOT NULL,
  `fill_simple_count` int(11) NOT NULL,
  `judgment_simple_count` int(11) NOT NULL,
  `single_mid_count` int(11) NOT NULL,
  `multiple_mid_count` int(11) NOT NULL,
  `fill_mid_count` int(11) NOT NULL,
  `judgment_mid_count` int(11) NOT NULL,
  `single_hard_count` int(11) NOT NULL,
  `multiple_hard_count` int(11) NOT NULL,
  `fill_hard_count` int(11) NOT NULL,
  `judgment_hard_count` int(11) NOT NULL,
  `single_scores` int(11) NOT NULL,
  `multiple_scores` int(11) NOT NULL,
  `fill_scores` int(11) NOT NULL,
  `judgment_scores` int(11) NOT NULL,
  `single_total_count` int(11) NOT NULL,
  `multiple_total_count` int(11) NOT NULL,
  `fill_total_count` int(11) NOT NULL,
  `judgment_total_count` int(11) NOT NULL,
  `single_total_scores` int(11) NOT NULL,
  `multiple_total_scores` int(11) NOT NULL,
  `fill_total_scores` int(11) NOT NULL,
  `judgment_total_scores` int(11) NOT NULL,
  `question_total_count` int(11) NOT NULL,
  `question_total_scores` int(11) NOT NULL,
  `create_time` datetime(6) NOT NULL,
  `is_delete` tinyint(1) NOT NULL,
  `did_count` int(11) NOT NULL,
  `create_user_id` int(11) NOT NULL,
  `subject_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `exam_paper_create_user_id_533cebef_fk_staff_user_id` (`create_user_id`),
  KEY `exam_paper_subject_id_81063cdf_fk_base_subject_id` (`subject_id`),
  CONSTRAINT `exam_paper_create_user_id_533cebef_fk_staff_user_id` FOREIGN KEY (`create_user_id`) REFERENCES `staff_user` (`id`),
  CONSTRAINT `exam_paper_subject_id_81063cdf_fk_base_subject_id` FOREIGN KEY (`subject_id`) REFERENCES `base_subject` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of exam_paper
-- ----------------------------

-- ----------------------------
-- Table structure for `exam_paper_detail`
-- ----------------------------
DROP TABLE IF EXISTS `exam_paper_detail`;
CREATE TABLE `exam_paper_detail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `order` int(11) NOT NULL,
  `delete` tinyint(1) NOT NULL,
  `main_id` int(11) NOT NULL,
  `question_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `exam_paper_detail_main_id_35b8fb28_fk_exam_paper_id` (`main_id`),
  KEY `exam_paper_detail_question_id_889e45d0_fk_exam_question_id` (`question_id`),
  CONSTRAINT `exam_paper_detail_main_id_35b8fb28_fk_exam_paper_id` FOREIGN KEY (`main_id`) REFERENCES `exam_paper` (`id`),
  CONSTRAINT `exam_paper_detail_question_id_889e45d0_fk_exam_question_id` FOREIGN KEY (`question_id`) REFERENCES `exam_question` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of exam_paper_detail
-- ----------------------------

-- ----------------------------
-- Table structure for `exam_question`
-- ----------------------------
DROP TABLE IF EXISTS `exam_question`;
CREATE TABLE `exam_question` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` smallint(5) unsigned NOT NULL,
  `difficulty` smallint(5) unsigned NOT NULL,
  `scores` int(11) NOT NULL,
  `title` longtext NOT NULL,
  `judgment` tinyint(1) NOT NULL,
  `analysis` longtext,
  `create_time` datetime(6) NOT NULL,
  `delete` tinyint(1) NOT NULL,
  `chapter_id` int(11) NOT NULL,
  `create_user_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `exam_question_chapter_id_527b99a8_fk_base_chapter_id` (`chapter_id`),
  KEY `exam_question_create_user_id_1b9bb3dc_fk_staff_user_id` (`create_user_id`),
  CONSTRAINT `exam_question_chapter_id_527b99a8_fk_base_chapter_id` FOREIGN KEY (`chapter_id`) REFERENCES `base_chapter` (`id`),
  CONSTRAINT `exam_question_create_user_id_1b9bb3dc_fk_staff_user_id` FOREIGN KEY (`create_user_id`) REFERENCES `staff_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of exam_question
-- ----------------------------

-- ----------------------------
-- Table structure for `exam_question_feedback`
-- ----------------------------
DROP TABLE IF EXISTS `exam_question_feedback`;
CREATE TABLE `exam_question_feedback` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` smallint(5) unsigned NOT NULL,
  `desc` longtext,
  `create_time` datetime(6) NOT NULL,
  `status` smallint(5) unsigned NOT NULL,
  `process_time` datetime(6) DEFAULT NULL,
  `create_user_id` int(11) NOT NULL,
  `main_id` int(11) NOT NULL,
  `process_user_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `exam_question_feedback_create_user_id_474b9632_fk_staff_user_id` (`create_user_id`),
  KEY `exam_question_feedback_main_id_0a5e8850_fk_exam_question_id` (`main_id`),
  KEY `exam_question_feedback_process_user_id_f8482974_fk_staff_user_id` (`process_user_id`),
  CONSTRAINT `exam_question_feedback_create_user_id_474b9632_fk_staff_user_id` FOREIGN KEY (`create_user_id`) REFERENCES `staff_user` (`id`),
  CONSTRAINT `exam_question_feedback_main_id_0a5e8850_fk_exam_question_id` FOREIGN KEY (`main_id`) REFERENCES `exam_question` (`id`),
  CONSTRAINT `exam_question_feedback_process_user_id_f8482974_fk_staff_user_id` FOREIGN KEY (`process_user_id`) REFERENCES `staff_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of exam_question_feedback
-- ----------------------------

-- ----------------------------
-- Table structure for `exam_question_fill`
-- ----------------------------
DROP TABLE IF EXISTS `exam_question_fill`;
CREATE TABLE `exam_question_fill` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `content` longtext NOT NULL,
  `order` int(11) NOT NULL,
  `delete` tinyint(1) NOT NULL,
  `main_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `exam_question_fill_main_id_057b5b10_fk_exam_question_id` (`main_id`),
  CONSTRAINT `exam_question_fill_main_id_057b5b10_fk_exam_question_id` FOREIGN KEY (`main_id`) REFERENCES `exam_question` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of exam_question_fill
-- ----------------------------

-- ----------------------------
-- Table structure for `exam_question_option`
-- ----------------------------
DROP TABLE IF EXISTS `exam_question_option`;
CREATE TABLE `exam_question_option` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `content` longtext NOT NULL,
  `right` tinyint(1) NOT NULL,
  `delete` tinyint(1) NOT NULL,
  `main_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `exam_question_option_main_id_f07847c8_fk_exam_question_id` (`main_id`),
  CONSTRAINT `exam_question_option_main_id_f07847c8_fk_exam_question_id` FOREIGN KEY (`main_id`) REFERENCES `exam_question` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of exam_question_option
-- ----------------------------

-- ----------------------------
-- Table structure for `knowledge_base`
-- ----------------------------
DROP TABLE IF EXISTS `knowledge_base`;
CREATE TABLE `knowledge_base` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(200) NOT NULL,
  `feature` longtext NOT NULL,
  `desc` longtext,
  `create_time` datetime(6) NOT NULL,
  `delete` tinyint(1) NOT NULL,
  `chapter_id` int(11) NOT NULL,
  `create_user_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `knowledge_base_chapter_id_5d383c8f_fk_base_chapter_id` (`chapter_id`),
  KEY `knowledge_base_create_user_id_dc18d11c_fk_staff_user_id` (`create_user_id`),
  CONSTRAINT `knowledge_base_chapter_id_5d383c8f_fk_base_chapter_id` FOREIGN KEY (`chapter_id`) REFERENCES `base_chapter` (`id`),
  CONSTRAINT `knowledge_base_create_user_id_dc18d11c_fk_staff_user_id` FOREIGN KEY (`create_user_id`) REFERENCES `staff_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of knowledge_base
-- ----------------------------

-- ----------------------------
-- Table structure for `knowledge_base_feedback`
-- ----------------------------
DROP TABLE IF EXISTS `knowledge_base_feedback`;
CREATE TABLE `knowledge_base_feedback` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` smallint(5) unsigned NOT NULL,
  `desc` longtext,
  `create_time` datetime(6) NOT NULL,
  `status` smallint(5) unsigned NOT NULL,
  `process_time` datetime(6) DEFAULT NULL,
  `create_user_id` int(11) NOT NULL,
  `main_id` int(11) NOT NULL,
  `process_user_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `knowledge_base_feedback_create_user_id_a33d831a_fk_staff_user_id` (`create_user_id`),
  KEY `knowledge_base_feedback_main_id_3474e6ae_fk_knowledge_base_id` (`main_id`),
  KEY `knowledge_base_feedb_process_user_id_b803bc89_fk_staff_use` (`process_user_id`),
  CONSTRAINT `knowledge_base_feedb_process_user_id_b803bc89_fk_staff_use` FOREIGN KEY (`process_user_id`) REFERENCES `staff_user` (`id`),
  CONSTRAINT `knowledge_base_feedback_create_user_id_a33d831a_fk_staff_user_id` FOREIGN KEY (`create_user_id`) REFERENCES `staff_user` (`id`),
  CONSTRAINT `knowledge_base_feedback_main_id_3474e6ae_fk_knowledge_base_id` FOREIGN KEY (`main_id`) REFERENCES `knowledge_base` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of knowledge_base_feedback
-- ----------------------------

-- ----------------------------
-- Table structure for `practise_answer_fill_log`
-- ----------------------------
DROP TABLE IF EXISTS `practise_answer_fill_log`;
CREATE TABLE `practise_answer_fill_log` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `content` longtext NOT NULL,
  `order` int(11) NOT NULL,
  `main_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `practise_answer_fill_main_id_dced144a_fk_practise_` (`main_id`),
  CONSTRAINT `practise_answer_fill_main_id_dced144a_fk_practise_` FOREIGN KEY (`main_id`) REFERENCES `practise_answer_log` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of practise_answer_fill_log
-- ----------------------------

-- ----------------------------
-- Table structure for `practise_answer_log`
-- ----------------------------
DROP TABLE IF EXISTS `practise_answer_log`;
CREATE TABLE `practise_answer_log` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `status` smallint(5) unsigned DEFAULT NULL,
  `main_id` int(11) NOT NULL,
  `question_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `practise_answer_log_main_id_df7c7f82_fk_practise_log_id` (`main_id`),
  KEY `practise_answer_log_question_id_813be9e8_fk_exam_question_id` (`question_id`),
  CONSTRAINT `practise_answer_log_main_id_df7c7f82_fk_practise_log_id` FOREIGN KEY (`main_id`) REFERENCES `practise_log` (`id`),
  CONSTRAINT `practise_answer_log_question_id_813be9e8_fk_exam_question_id` FOREIGN KEY (`question_id`) REFERENCES `exam_question` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of practise_answer_log
-- ----------------------------

-- ----------------------------
-- Table structure for `practise_answer_option_log`
-- ----------------------------
DROP TABLE IF EXISTS `practise_answer_option_log`;
CREATE TABLE `practise_answer_option_log` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `main_id` int(11) NOT NULL,
  `option_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `practise_answer_opti_main_id_53e10538_fk_practise_` (`main_id`),
  KEY `practise_answer_opti_option_id_07194fed_fk_exam_ques` (`option_id`),
  CONSTRAINT `practise_answer_opti_main_id_53e10538_fk_practise_` FOREIGN KEY (`main_id`) REFERENCES `practise_answer_log` (`id`),
  CONSTRAINT `practise_answer_opti_option_id_07194fed_fk_exam_ques` FOREIGN KEY (`option_id`) REFERENCES `exam_question_option` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of practise_answer_option_log
-- ----------------------------

-- ----------------------------
-- Table structure for `practise_error_book`
-- ----------------------------
DROP TABLE IF EXISTS `practise_error_book`;
CREATE TABLE `practise_error_book` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `last_time` datetime(6) NOT NULL,
  `wrong_count` int(11) NOT NULL,
  `create_user_id` int(11) NOT NULL,
  `last_answer_log_id` int(11) NOT NULL,
  `question_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `practise_error_book_create_user_id_db579338_fk_staff_user_id` (`create_user_id`),
  KEY `practise_error_book_last_answer_log_id_71418026_fk_exam_answ` (`last_answer_log_id`),
  KEY `practise_error_book_question_id_b58245d7_fk_exam_question_id` (`question_id`),
  CONSTRAINT `practise_error_book_create_user_id_db579338_fk_staff_user_id` FOREIGN KEY (`create_user_id`) REFERENCES `staff_user` (`id`),
  CONSTRAINT `practise_error_book_last_answer_log_id_71418026_fk_exam_answ` FOREIGN KEY (`last_answer_log_id`) REFERENCES `exam_answer_log` (`id`),
  CONSTRAINT `practise_error_book_question_id_b58245d7_fk_exam_question_id` FOREIGN KEY (`question_id`) REFERENCES `exam_question` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of practise_error_book
-- ----------------------------

-- ----------------------------
-- Table structure for `practise_log`
-- ----------------------------
DROP TABLE IF EXISTS `practise_log`;
CREATE TABLE `practise_log` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` smallint(5) unsigned NOT NULL,
  `create_time` datetime(6) NOT NULL,
  `submit_time` datetime(6) DEFAULT NULL,
  `right_count` int(11) NOT NULL,
  `wrong_count` int(11) NOT NULL,
  `total_count` int(11) NOT NULL,
  `begin_answer_id` int(11) DEFAULT NULL,
  `chapter_id` int(11) DEFAULT NULL,
  `create_user_id` int(11) NOT NULL,
  `end_answer_id` int(11) DEFAULT NULL,
  `subject_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `practise_log_begin_answer_id_934c990a_fk_practise_answer_log_id` (`begin_answer_id`),
  KEY `practise_log_chapter_id_69d2fc81_fk_base_chapter_id` (`chapter_id`),
  KEY `practise_log_create_user_id_e0e2795c_fk_staff_user_id` (`create_user_id`),
  KEY `practise_log_end_answer_id_8c9de0ae_fk_practise_answer_log_id` (`end_answer_id`),
  KEY `practise_log_subject_id_7608f3f5_fk_base_subject_id` (`subject_id`),
  CONSTRAINT `practise_log_begin_answer_id_934c990a_fk_practise_answer_log_id` FOREIGN KEY (`begin_answer_id`) REFERENCES `practise_answer_log` (`id`),
  CONSTRAINT `practise_log_chapter_id_69d2fc81_fk_base_chapter_id` FOREIGN KEY (`chapter_id`) REFERENCES `base_chapter` (`id`),
  CONSTRAINT `practise_log_create_user_id_e0e2795c_fk_staff_user_id` FOREIGN KEY (`create_user_id`) REFERENCES `staff_user` (`id`),
  CONSTRAINT `practise_log_end_answer_id_8c9de0ae_fk_practise_answer_log_id` FOREIGN KEY (`end_answer_id`) REFERENCES `practise_answer_log` (`id`),
  CONSTRAINT `practise_log_subject_id_7608f3f5_fk_base_subject_id` FOREIGN KEY (`subject_id`) REFERENCES `base_subject` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of practise_log
-- ----------------------------

-- ----------------------------
-- Table structure for `staff_department`
-- ----------------------------
DROP TABLE IF EXISTS `staff_department`;
CREATE TABLE `staff_department` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `notes` varchar(500) DEFAULT NULL,
  `parent_id` int(11) DEFAULT NULL,
  `lft` int(11) NOT NULL,
  `rgt` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of staff_department
-- ----------------------------

-- ----------------------------
-- Table structure for `staff_user`
-- ----------------------------
DROP TABLE IF EXISTS `staff_user`;
CREATE TABLE `staff_user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `password` varchar(128) NOT NULL,
  `last_login` datetime(6) DEFAULT NULL,
  `is_superuser` tinyint(1) NOT NULL,
  `type` smallint(5) unsigned NOT NULL,
  `username` varchar(30) NOT NULL,
  `name` varchar(30) NOT NULL,
  `is_active` tinyint(1) NOT NULL,
  `date_joined` datetime(6) NOT NULL,
  `department_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`),
  UNIQUE KEY `staff_user_username_039485a3_uniq` (`username`),
  KEY `staff_user_department_id_aa13ac5f_fk_staff_department_id` (`department_id`),
  KEY `staff_user_date_joined_7681f7b6_idx` (`date_joined`),
  CONSTRAINT `staff_user_department_id_aa13ac5f_fk_staff_department_id` FOREIGN KEY (`department_id`) REFERENCES `staff_department` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of staff_user
-- ----------------------------

-- ----------------------------
-- Table structure for `staff_user_groups`
-- ----------------------------
DROP TABLE IF EXISTS `staff_user_groups`;
CREATE TABLE `staff_user_groups` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `group_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `staff_user_groups_user_id_group_id_7487dd55_uniq` (`user_id`,`group_id`),
  KEY `staff_user_groups_group_id_f268c67d_fk_auth_group_id` (`group_id`),
  CONSTRAINT `staff_user_groups_group_id_f268c67d_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`),
  CONSTRAINT `staff_user_groups_user_id_d6a7bab4_fk_staff_user_id` FOREIGN KEY (`user_id`) REFERENCES `staff_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of staff_user_groups
-- ----------------------------

-- ----------------------------
-- Table structure for `staff_user_user_permissions`
-- ----------------------------
DROP TABLE IF EXISTS `staff_user_user_permissions`;
CREATE TABLE `staff_user_user_permissions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `permission_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `staff_user_user_permissions_user_id_permission_id_508e3d20_uniq` (`user_id`,`permission_id`),
  KEY `staff_user_user_perm_permission_id_f36572eb_fk_auth_perm` (`permission_id`),
  CONSTRAINT `staff_user_user_perm_permission_id_f36572eb_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`),
  CONSTRAINT `staff_user_user_permissions_user_id_47d1712b_fk_staff_user_id` FOREIGN KEY (`user_id`) REFERENCES `staff_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of staff_user_user_permissions
-- ----------------------------

-- ----------------------------
-- Table structure for `sys_log`
-- ----------------------------
DROP TABLE IF EXISTS `sys_log`;
CREATE TABLE `sys_log` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` smallint(5) unsigned NOT NULL,
  `description` varchar(1000) NOT NULL,
  `data` longtext,
  `create_time` datetime(6) NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `sys_log_user_id_4b944456_fk_staff_user_id` (`user_id`),
  KEY `sys_log_create_time_type_78f30482_idx` (`create_time`,`type`),
  CONSTRAINT `sys_log_user_id_4b944456_fk_staff_user_id` FOREIGN KEY (`user_id`) REFERENCES `staff_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of sys_log
-- ----------------------------
