-- 新增挂测任务表
CREATE TABLE IF NOT EXISTS `oper_mount_upgrade_task`  (
  `id` bigint(0) NOT NULL COMMENT '主键',
  `sn` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备sn',
  `previous_firmware_version` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备先前固件版本',
  `loop_count` int(0) NULL DEFAULT NULL COMMENT '循环次数',
  `pack_count` int(0) NULL DEFAULT NULL COMMENT '升级包数量',
  `upgrade_count` int(0) NULL DEFAULT 0 COMMENT '已升级次数',
  `status` int(0) NULL DEFAULT 0 COMMENT '状态：0未开始 10进行中 15暂停 20成功 21失败 22终止',
  `creator_id` bigint(0) NULL DEFAULT NULL COMMENT '创建者',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  `finish_time` datetime(0) NULL DEFAULT NULL COMMENT '结束时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '运维-升级挂测任务' ROW_FORMAT = Dynamic;

-- 新增挂测任务固件表
CREATE TABLE IF NOT EXISTS `oper_mount_upgrade_firmware`  (
  `id` bigint(0) NOT NULL COMMENT '主键',
  `firmware_id` bigint(0) NULL DEFAULT NULL COMMENT '固件升级包id',
  `firmware_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '固件文件名',
  `mount_task_id` bigint(0) NULL DEFAULT NULL COMMENT '挂测任务id',
  `sort` int(0) NULL DEFAULT NULL COMMENT '排序值',
  `upgrade_count` int(0) NULL DEFAULT 0 COMMENT '已升级次数',
  `length` int(0) NULL DEFAULT 1024 COMMENT '帧长度',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '运维-升级挂测任务固件' ROW_FORMAT = Dynamic;

-- 新增挂测日志表
CREATE TABLE IF NOT EXISTS `oper_mount_upgrade_log`  (
  `id` bigint(0) NOT NULL COMMENT '主键',
  `mount_task_id` bigint(0) NULL DEFAULT NULL COMMENT '挂测任务id',
  `mount_firmware_id` bigint(0) NULL DEFAULT NULL COMMENT '挂测任务固件id',
  `stage` int(0) NULL DEFAULT NULL COMMENT '升级环节',
  `content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '日志内容',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '运维-升级挂测任务日志' ROW_FORMAT = Dynamic;