ALTER TABLE double_defense.work_ticket_extend
  CHANGE hw_work_way hw_work_way VARCHAR (10) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '动火方式',
  CHANGE hw_work_location hw_work_location VARCHAR (50) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '动火地点及动火部位',
  CHANGE rs_work_name rs_work_name VARCHAR (50) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '受限空间名称',
  CHANGE rs_work_medium_name rs_work_medium_name VARCHAR (50) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '受限空间内原有介质名称';

ALTER TABLE double_defense.tb_hazard
    ADD COLUMN device_id VARCHAR(36) NULL COMMENT '设备设施表主键（非必选）' AFTER id;
    ALTER TABLE double_defense.tb_danger
    ADD COLUMN danger_no VARCHAR(36) NOT NULL COMMENT '隐患编号' AFTER id;

ALTER TABLE double_defense.tb_danger_operate_record
    CHANGE operate_user_name operate_user_name VARCHAR(128) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '隐患操作用户名',
    ADD COLUMN operate_nick_name VARCHAR(128) NULL COMMENT '隐患操作用户姓名' AFTER operate_user_name;

ALTER TABLE double_defense.tb_danger_operate_record
    CHANGE danger_status danger_status INT(11) NULL COMMENT '隐患状态:10待审核，20认领中，30整改中，40待验收，50已验收，60取消';
    RENAME TABLE double_defense.tb_sys_area_user_relation TO double_defense.$tb_sys_area_user_relation;

ALTER TABLE double_defense.tb_sys_area
    ADD COLUMN post_id BIGINT NOT NULL COMMENT '岗位ID' AFTER remark;
    RENAME TABLE double_defense.tb_check_task_post_relation TO double_defense.$tb_check_task_post_relation;

ALTER TABLE double_defense.tb_check_task
    ADD COLUMN post_id BIGINT NOT NULL COMMENT '岗位ID（调整为只能绑定一个岗位）' AFTER remark_info;
    ALTER TABLE double_defense.work_ticket_basic_data
    CHANGE work_ticket_director_id work_ticket_director_id BIGINT(20) NULL COMMENT '作业负责人（内部人员）';

ALTER TABLE double_defense.sys_notice
    CHANGE notice_type notice_type CHAR(1) CHARSET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '公告类型（1通知 2公告 3个人消息）',
    ADD COLUMN user_id BIGINT NULL COMMENT '用户ID：tb_app_login' AFTER STATUS,
    ADD COLUMN is_read INT NULL COMMENT '0-未读1-已读' AFTER user_id;

ALTER TABLE double_defense.sys_notice
    ADD COLUMN app_route VARCHAR(64) NULL COMMENT 'APP路由标识' AFTER is_read,
    ADD COLUMN pc_route VARCHAR(64) NULL COMMENT 'PC路由标识' AFTER app_route;

ALTER TABLE double_defense.work_ticket_basic_data
    CHANGE work_ticket_guardian_user work_ticket_guardian_user VARCHAR(36) NULL COMMENT '作业监护人';

ALTER TABLE double_defense.work_ticket_extend
    CHANGE bp_work_spec bp_work_spec VARCHAR(128) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '盲板抽堵作业-规格',
    CHANGE bp_work_number bp_work_number VARCHAR(64) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '盲板抽堵作业-编号',
    CHANGE bp_work_img_url bp_work_img_url VARCHAR(255) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '盲板抽堵作业-位置图',
    CHANGE ho_work_spreader_name ho_work_spreader_name VARCHAR(128) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '吊装作业-吊具名称',
    CHANGE bg_work_describe bg_work_describe VARCHAR(255) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '动土作业-描述',
    CHANGE bg_work_img bg_work_img VARCHAR(255) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '动土作业-简图',
    CHANGE rb_work_reason rb_work_reason VARCHAR(255) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '断路作业-断路原因',
    CHANGE rb_work_illustrate rb_work_illustrate VARCHAR(255) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '断路作业-相关说明',
    CHANGE rb_work_img rb_work_img VARCHAR(255) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '断路作业-地段示意图';

ALTER TABLE double_defense.work_ticket_basic_data
    CHANGE work_ticket_disclose_user_sign_img work_ticket_disclose_user_sign_img BIGINT(255) NULL COMMENT '作业交底人签字图片',
    CHANGE work_ticket_accept_user_sign_img work_ticket_accept_user_sign_img BIGINT(255) NULL COMMENT '作业接受人签字图片',
    CHANGE work_ticket_measures_user_sign_img work_ticket_measures_user_sign_img BIGINT(255) NULL COMMENT '安全措施确认人签字图片',
    CHANGE measures_complement_user_sign_img measures_complement_user_sign_img VARCHAR(255) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '编制人签字图片',
    CHANGE work_ticket_check_user_sign_img work_ticket_check_user_sign_img VARCHAR(255) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '验收人签字图片';

ALTER TABLE double_defense.work_ticket_basic_data
    CHANGE work_ticket_disclose_user_sign_img work_ticket_disclose_user_sign_img VARCHAR(255) NULL COMMENT '作业交底人签字图片',
    CHANGE work_ticket_accept_user_sign_img work_ticket_accept_user_sign_img VARCHAR(255) NULL COMMENT '作业接受人签字图片',
    CHANGE work_ticket_measures_user_sign_img work_ticket_measures_user_sign_img VARCHAR(255) NULL COMMENT '安全措施确认人签字图片';

ALTER TABLE double_defense.work_ticket_basic_data
    CHANGE work_ticket_guardian_user work_ticket_guardian_user BIGINT(20) NULL COMMENT '作业监护人(承包商、内部都时必选字段)';

ALTER TABLE double_defense.work_ticket_sm_option_run
    ADD COLUMN is_option INT DEFAULT 0 NOT NULL COMMENT '是否模板配置项：0-是；1-否（页面添加）' AFTER sm_option_state;

ALTER TABLE double_defense.work_ticket_gas_analysis
    ADD COLUMN inspectorate VARCHAR(36) NULL COMMENT '检测人' AFTER work_ticket_id;

ALTER TABLE double_defense.work_ticket_basic_data
    CHANGE work_ticket_status work_ticket_status VARCHAR(10) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '作业状态 0 待审核，90已驳回，10 申请中(措施待确认)、20待交底（措施已确定，等待交底人签字）、30会签中（已交底）、40作业中（已会签完成）、50已验收',
    CHANGE work_ticket_company_type work_ticket_company_type VARCHAR(10) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '作业单位类型 10承包商、20内部',
    CHANGE work_ticket_company work_ticket_company BIGINT(20) NOT NULL COMMENT '作业单位,承包商ID或部门ID',
    CHANGE work_ticket_type work_ticket_type VARCHAR(10) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '作业票类型 10动火、20受限、30盲板抽堵、40高处、50吊装、60临时、70动土、80断路',
    CHANGE work_ticket_director_id work_ticket_director_id BIGINT(20) NOT NULL COMMENT '作业负责人（内部人员）',
    CHANGE work_ticket_guardian_user work_ticket_guardian_user VARCHAR(36) NOT NULL COMMENT '作业监护人(承包商时承包商用户ID、内部时系统用户ID)';

RENAME TABLE shuangkong.tb_check_task_post_relation TO shuangkong.$$tb_check_task_post_relation;

ALTER TABLE shuangkong.employee_course_exam_records
    ADD COLUMN pass INT NULL COMMENT '是否通过：1-不通过；2-通过' AFTER staff_id;

ALTER TABLE double_defense.tb_check_task
    ADD COLUMN check_type_count INT NOT NULL COMMENT '巡查方式：1-单位周期N次；2-时间段内1次；' AFTER check_type;

ALTER TABLE double_defense.tb_check_task
    CHANGE check_type_count check_type_count INT(11) DEFAULT 1 NOT NULL COMMENT '巡查方式：1-单位周期N次；2-时间段内1次；';

RENAME TABLE double_defense.work_tecket_execute_user TO double_defense.$work_tecket_execute_user;

ALTER TABLE double_defense.work_ticket_extend
    CHANGE rb_work_relevant_units rb_work_relevant_units VARCHAR(100) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '断路作业-相关单位（部门）';

ALTER TABLE double_defense.tb_danger
    ADD COLUMN reject_user_name VARCHAR(32) NULL COMMENT '驳回人的姓名：审核驳回、待验收驳回' AFTER danger_status,
    CHANGE remark_info remark_info VARCHAR(500) CHARSET utf8 COLLATE utf8_general_ci NULL COMMENT '备注（驳回原因：审核驳回、待验收驳回）';

ALTER TABLE double_defense.tb_danger
    CHANGE danger_status danger_status INT(11) NOT NULL COMMENT '隐患状态：10待审核，20认领中，30整改中，40待验收，50已验收，60取消（原备份：1认领中，2整改中，3待验收，4已验收，5取消）';

ALTER TABLE double_defense.tb_danger_manage
    ADD COLUMN rectification_time DATETIME NULL COMMENT '添加整改时间（APP提交整改信息时添加）' AFTER danger_manage_deaddline;

ALTER TABLE double_defense.tb_danger
  ADD COLUMN hazard_id VARCHAR (36) NULL COMMENT '必选->风险分析对象ID' AFTER area_id,
  ADD COLUMN risk_measure_id VARCHAR (36) NULL COMMENT '(选填->巡检上报时需要设置值)所属管控措施UUID' AFTER hazard_id,
  ADD COLUMN check_task_inventory_record_id VARCHAR (36) NULL COMMENT '(选填->巡检上报时需要设置值)隐患排查记录ID' AFTER risk_measure_id;

ALTER TABLE double_defense.tb_danger
  CHANGE device_id device_id VARCHAR (36) CHARSET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '（废弃）设备UUID',
  CHANGE check_record_id check_record_id VARCHAR (36) CHARSET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '（废弃）排查记录ID，变为check_task_inventory_record_id';

ALTER TABLE double_defense.tb_danger_manage
  CHANGE cost cost VARCHAR (100) CHARSET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '整改资金(万元)';
