-- 1.6.0
USE `stmms_ft`;
ALTER TABLE eb_exam ADD COLUMN `track_count_policy`   varchar(16) DEFAULT NULL COMMENT '轨迹次数规则';
ALTER TABLE eb_exam_question ADD COLUMN `track_count` int(11) NOT NULL COMMENT '给分次数';
ALTER TABLE eb_exam_student ADD COLUMN `collation_label_code` varchar(64) DEFAULT NULL COMMENT '回卷标识代码';
ALTER TABLE eb_exam_subject ADD COLUMN `enable_all_selective`  tinyint(1)  NOT NULL COMMENT '开启一键未选做';

INSERT INTO `b_privilege` (`code`, `name`, `parent_code`, `privilege_type`, `level`, `seq`)
VALUES ('exam_problem_history-export', '导出', 'exam_problem_history', 'BUTTON', 2, 3);
INSERT INTO b_role_privilege (`school_id`, `role_code`, `privilege_code`,`enable`)
SELECT s.id,'SCHOOL_ADMIN',p.`code`,1 from b_privilege p join b_school s
where p.`code` ='exam_problem_history-export';
INSERT INTO b_role_privilege (`school_id`, `role_code`, `privilege_code`,`enable`)
SELECT s.id,'SUBJECT_HEADER',p.`code`,0 from b_privilege p join b_school s
where p.`code` ='exam_problem_history-export';
INSERT INTO b_role_privilege (`school_id`, `role_code`, `privilege_code`,`enable`)
SELECT s.id,'COLLEGE_ADMIN',p.`code`,0 from b_privilege p join b_school s
where p.`code` ='exam_problem_history-export';

DROP TABLE IF EXISTS `eb_collation_label`;
CREATE TABLE `eb_collation_label`
(
    `exam_id`      int(11)      NOT NULL COMMENT '考试ID',
    `code`         varchar(64)  NOT NULL COMMENT '代码',
    `name`         varchar(255)     NOT NULL COMMENT '名称',
    `update_time`  datetime     DEFAULT NULL COMMENT '修改时间',
    PRIMARY KEY (`exam_id`, `code`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8mb4 COMMENT ='回卷整理标识表';