oe_sync.sql 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. -- 1.ec_oe_exam_audit表删除旧索引,并添加新索引
  2. drop index idx_exam_record_data_id on ec_oe_exam_audit;
  3. alter table ec_oe_exam_audit add UNIQUE INDEX IDX_E_O_E_A_001 (`exam_record_data_id`) USING BTREE;
  4. -- 2.1.ec_oe_exam_capture字段更新
  5. alter table ec_oe_exam_capture MODIFY `face_compare_result` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '人脸比较返回信息';
  6. alter table ec_oe_exam_capture MODIFY `faceliveness_result` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '百度在线活体检测结果-3.0新增';
  7. alter table ec_oe_exam_capture MODIFY `ext_msg` varchar(800) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '其他信息';
  8. -- 2.2.ec_oe_exam_capture表删除旧索引,并添加新索引
  9. drop index idx_001 on ec_oe_exam_capture;
  10. drop index idx_002 on ec_oe_exam_capture;
  11. alter table ec_oe_exam_capture ADD UNIQUE INDEX IDX_E_O_E_C_001 (`exam_record_data_id`, `file_name` ) USING BTREE;
  12. alter table ec_oe_exam_capture add index IDX_E_O_E_C_002 (`exam_record_data_id` ) USING BTREE;
  13. -- 3.ec_oe_exam_capture_queue表直接删除重建
  14. DROP TABLE IF EXISTS `ec_oe_exam_capture_queue`;
  15. CREATE TABLE `ec_oe_exam_capture_queue` (
  16. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  17. `student_id` bigint(20) NOT NULL COMMENT '学生ID',
  18. `exam_record_data_id` bigint(20) NOT NULL,
  19. `base_face_token` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '底照token',
  20. `file_url` varchar(150) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '照片的url',
  21. `file_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '照片名称',
  22. `status` varchar(30) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '待处理,处理中,处理失败',
  23. `error_msg` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  24. `error_num` int(11) NOT NULL DEFAULT 0,
  25. `has_virtual_camera` bit(1) NULL DEFAULT NULL,
  26. `camera_infos` varchar(800) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  27. `ext_msg` varchar(800) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  28. `creation_time` datetime(0) NULL DEFAULT NULL,
  29. `update_time` datetime(0) NULL DEFAULT NULL,
  30. `process_batch_num` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  31. `face_compare_result` varchar(2000) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  32. `priority` int(11) NULL DEFAULT 0,
  33. `face_compare_start_time` bigint(20) NULL DEFAULT NULL,
  34. `faceliveness_result` varchar(2000) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  35. `is_pass` bit(1) NULL DEFAULT NULL,
  36. `is_stranger` bit(1) NULL DEFAULT NULL,
  37. PRIMARY KEY (`id`) USING BTREE,
  38. UNIQUE INDEX `IDX_E_O_E_C_Q_001`(`exam_record_data_id`, `file_name`) USING BTREE,
  39. INDEX `IDX_E_O_E_C_Q_002`(`status`, `error_num`) USING BTREE
  40. ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_bin ROW_FORMAT = Dynamic;
  41. -- 4.ec_oe_exam_face_liveness_verify表删除再重建索引
  42. drop index idx_001 on ec_oe_exam_face_liveness_verify;
  43. drop index idx_002 on ec_oe_exam_face_liveness_verify;
  44. alter table ec_oe_exam_face_liveness_verify add index IDX_E_O_E_F_L_V_001 (`exam_record_data_id`, `is_error` ) USING BTREE;
  45. -- 5.添加新表ec_oe_exam_file_answer_temp
  46. CREATE TABLE `ec_oe_exam_file_answer_temp` (
  47. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  48. `creation_time` datetime(0) NOT NULL,
  49. `update_time` datetime(0) NOT NULL,
  50. `exam_record_data_id` bigint(20) NOT NULL,
  51. `exam_student_id` bigint(20) NOT NULL,
  52. `file_path` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  53. `question_order` int(11) NOT NULL,
  54. `status` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  55. `transfer_file_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  56. PRIMARY KEY (`id`) USING BTREE,
  57. UNIQUE INDEX `IDX_E_O_E_F_A_T_001`(`exam_record_data_id`, `exam_student_id`, `question_order`, `file_path`) USING BTREE
  58. ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
  59. -- 6.1.ec_oe_exam_org_score_handle表字段更新
  60. alter table ec_oe_exam_org_score_handle MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
  61. alter table ec_oe_exam_org_score_handle MODIFY `root_org_id` bigint(20) NOT NULL;
  62. -- 6.2.ec_oe_exam_org_score_handle表删除旧索引,清加新索引
  63. drop index idx_001 on ec_oe_exam_org_score_handle;
  64. alter table ec_oe_exam_org_score_handle ADD UNIQUE INDEX `IDX_E_O_E_O_S_H_001`(`root_org_id` ) USING BTREE;
  65. -- 7.1.ec_oe_exam_record表字段更新
  66. alter table ec_oe_exam_record MODIFY `course_id` bigint(20) NOT NULL COMMENT '课程id';
  67. alter table ec_oe_exam_record MODIFY `root_org_id` bigint(20) NOT NULL COMMENT '顶级机构ID';
  68. alter table ec_oe_exam_record MODIFY `org_id` bigint(20) NOT NULL COMMENT '学习中心ID';
  69. alter table ec_oe_exam_record MODIFY `paper_type` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL;
  70. alter table ec_oe_exam_record MODIFY `info_collector` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '采集人';
  71. -- 7.2.ec_oe_exam_record表,删除旧索引,添加新索引
  72. drop index idx_001 on ec_oe_exam_record;
  73. drop index idx_002 on ec_oe_exam_record;
  74. drop index idx_003 on ec_oe_exam_record;
  75. drop index idx_004 on ec_oe_exam_record;
  76. drop index idx_005 on ec_oe_exam_record;
  77. drop index idx_006 on ec_oe_exam_record;
  78. alter table ec_oe_exam_record add index IDX_E_O_E_R_001 (`exam_student_id`) USING BTREE;
  79. alter table ec_oe_exam_record add index IDX_E_O_E_R_002 (`student_code`) USING BTREE;
  80. alter table ec_oe_exam_record add index IDX_E_O_E_R_003 (`student_id`, `exam_type`) USING BTREE;
  81. -- 8.1.ec_oe_exam_record_4_marking表字段更新
  82. alter table ec_oe_exam_record_4_marking MODIFY `course_id` bigint(20) NOT NULL;
  83. -- 8.2.ec_oe_exam_record_4_marking表删除旧索引,添加新索引
  84. drop index uniq_001 on ec_oe_exam_record_4_marking;
  85. drop index idx_002 on ec_oe_exam_record_4_marking;
  86. drop index idx_003 on ec_oe_exam_record_4_marking;
  87. alter table ec_oe_exam_record_4_marking ADD UNIQUE INDEX IDX_E_O_E_R_4_M_001 (`exam_record_data_id`) USING BTREE;
  88. alter table ec_oe_exam_record_4_marking add INDEX IDX_E_O_E_R_4_M_002 (`exam_id`) USING BTREE;
  89. alter table ec_oe_exam_record_4_marking add INDEX IDX_E_O_E_R_4_M_003 (`exam_student_id`) USING BTREE;
  90. -- 9.1.ec_oe_exam_record_data表字段更新
  91. alter table ec_oe_exam_record_data MODIFY `is_warn` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否是异常数据';
  92. alter table ec_oe_exam_record_data MODIFY `is_audit` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否被审核过';
  93. alter table ec_oe_exam_record_data MODIFY `is_illegality` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否违纪';
  94. alter table ec_oe_exam_record_data MODIFY `is_reexamine` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否为重考';
  95. alter table ec_oe_exam_record_data MODIFY `is_continued` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否存在断点续考';
  96. alter table ec_oe_exam_record_data MODIFY `is_all_objective_paper` bit(1) NULL DEFAULT NULL COMMENT '本次的试卷是否是全客观题卷';
  97. alter table ec_oe_exam_record_data ADD COLUMN `exam_record_questions_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL;
  98. -- 9.2.ec_oe_exam_record_data表删除外键约束
  99. alter table ec_oe_exam_record_data drop foreign key FKj4vu1t2fb85iefm7pwymi2evo;
  100. alter table ec_oe_exam_record_data drop foreign key fk_exam_record_id;
  101. -- 9.3.ec_oe_exam_record_data表删除旧索引,添加新索引
  102. drop index uniq_01 on ec_oe_exam_record_data;
  103. drop index idx_02 on ec_oe_exam_record_data;
  104. drop index idx_03 on ec_oe_exam_record_data;
  105. alter table ec_oe_exam_record_data ADD UNIQUE INDEX IDX_E_O_E_R_D_001 (`exam_record_id`) USING BTREE;
  106. alter table ec_oe_exam_record_data add INDEX IDX_E_O_E_R_D_002 (`exam_record_status`) USING BTREE;
  107. -- 10.ec_oe_exam_score表删除旧索引,添加新索引
  108. drop index idx_exam_record_data_id on ec_oe_exam_score;
  109. alter table ec_oe_exam_score ADD UNIQUE INDEX IDX_E_O_E_S_001 (`exam_record_data_id`) USING BTREE;
  110. -- 11.1.ec_oe_exam_score_obtain_queue表字段更新
  111. alter table ec_oe_exam_score_obtain_queue MODIFY `exam_id` bigint(20) NOT NULL;
  112. alter table ec_oe_exam_score_obtain_queue MODIFY `is_valid` bit(1) NOT NULL COMMENT '是否有效';
  113. -- 11.2.ec_oe_exam_score_obtain_queue表删除旧索引,添加新索引
  114. drop index idx_001 on ec_oe_exam_score_obtain_queue;
  115. drop index idx_002 on ec_oe_exam_score_obtain_queue;
  116. drop index idx_003 on ec_oe_exam_score_obtain_queue;
  117. alter table ec_oe_exam_score_obtain_queue add INDEX `IDX_E_O_E_S_O_Q_001`(`exam_record_data_id`) USING BTREE;
  118. alter table ec_oe_exam_score_obtain_queue add INDEX IDX_E_O_E_S_O_Q_002 (`root_org_id`, `is_valid`) USING BTREE;
  119. alter table ec_oe_exam_score_obtain_queue add INDEX IDX_E_O_E_S_O_Q_003(`exam_id`) USING BTREE;
  120. -- 12.1.ec_oe_exam_score_push_queue表字段更新
  121. alter table ec_oe_exam_score_push_queue MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
  122. alter table ec_oe_exam_score_push_queue MODIFY `exam_id` bigint(20) NOT NULL COMMENT '考试ID';
  123. alter table ec_oe_exam_score_push_queue MODIFY `exam_record_id` bigint(20) NOT NULL COMMENT '考试记录ID';
  124. alter table ec_oe_exam_score_push_queue MODIFY `exam_score_id` bigint(20) NOT NULL COMMENT '考试分数ID';
  125. alter table ec_oe_exam_score_push_queue MODIFY `root_org_id` bigint(20) NOT NULL COMMENT '学校ID';
  126. alter table ec_oe_exam_score_push_queue MODIFY `exam_id` bigint(20) NOT NULL COMMENT '考试ID';
  127. -- 12.2.ec_oe_exam_score_push_queue表删除旧索引,添加新索引
  128. drop index idx_01 on ec_oe_exam_score_push_queue;
  129. drop index uniq_002 on ec_oe_exam_score_push_queue;
  130. drop index uniq_003 on ec_oe_exam_score_push_queue;
  131. alter table ec_oe_exam_score_push_queue add INDEX `IDX_E_O_E_S_P_Q_001`(`status`) USING BTREE;
  132. alter table ec_oe_exam_score_push_queue ADD UNIQUE INDEX `IDX_E_O_E_S_P_Q_002`(`exam_record_id`) USING BTREE;
  133. alter table ec_oe_exam_score_push_queue ADD UNIQUE INDEX `IDX_E_O_E_S_P_Q_003`(`exam_score_id`) USING BTREE;
  134. -- 13.1.ec_oe_exam_student表字段更新
  135. alter table ec_oe_exam_student MODIFY `info_collector` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '采集人';
  136. alter table ec_oe_exam_student MODIFY `grade` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL;
  137. -- 13.2.ec_oe_exam_student表删除旧索引,添加新索引
  138. drop index idx_001 on ec_oe_exam_student;
  139. drop index idx_002 on ec_oe_exam_student;
  140. drop index idx_003 on ec_oe_exam_student;
  141. drop index idx_004 on ec_oe_exam_student;
  142. drop index idx_005 on ec_oe_exam_student;
  143. alter table ec_oe_exam_student ADD UNIQUE INDEX `IDX_E_O_E_S_001`(`exam_student_id`) USING BTREE;
  144. alter table ec_oe_exam_student add INDEX `IDX_E_O_E_S_002`(`student_id`) USING BTREE;
  145. alter table ec_oe_exam_student add INDEX `IDX_E_O_E_S_003`(`identity_number`) USING BTREE;
  146. alter table ec_oe_exam_student add INDEX `IDX_E_O_E_S_004`(`student_code`) USING BTREE;
  147. alter table ec_oe_exam_student add INDEX `IDX_E_O_E_S_005`(`exam_id`) USING BTREE;
  148. -- 14.添加新表ec_oe_examing_record
  149. CREATE TABLE `ec_oe_examing_record` (
  150. `id` bigint(20) NOT NULL,
  151. `creation_time` datetime(0) NOT NULL,
  152. `update_time` datetime(0) NOT NULL,
  153. `exam_record_data_id` bigint(20) NULL DEFAULT NULL,
  154. `student_id` bigint(20) NULL DEFAULT NULL,
  155. `is_exceed` bit(1) NULL DEFAULT NULL,
  156. `continued_count` int(11) NULL DEFAULT NULL,
  157. `exam_type` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  158. `is_continued` bit(1) NULL DEFAULT NULL,
  159. PRIMARY KEY (`id`) USING BTREE,
  160. INDEX `IDX_E_O_E_R_001`(`exam_record_data_id`) USING BTREE,
  161. INDEX `IDX_E_O_E_R_002`(`student_id`) USING BTREE,
  162. INDEX `IDX_E_O_E_R_003`(`exam_type`) USING BTREE
  163. ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
  164. -- 15.添加新表ec_oe_hand_in_exam_record
  165. CREATE TABLE `ec_oe_hand_in_exam_record` (
  166. `id` bigint(20) NOT NULL,
  167. `creation_time` datetime(0) NOT NULL,
  168. `update_time` datetime(0) NOT NULL,
  169. `exam_record_data_id` bigint(20) NOT NULL,
  170. `student_id` bigint(20) NOT NULL,
  171. PRIMARY KEY (`id`) USING BTREE,
  172. INDEX `IDX_E_O_H_I_E_R_001`(`exam_record_data_id`) USING BTREE
  173. ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;