-- 图片报历史记录表
CREATE TABLE `dev_report_pic_history`  (
   `id` bigint(0) NOT NULL COMMENT 'id',
   `unique_key` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联合唯一索引，用于防止重复数据',
   `tenant_id` bigint(0) NULL DEFAULT NULL COMMENT '租户id',
   `access_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备接入id',
   `camera_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '摄像头id',
   `channel` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '通道, 格式为设备accessId_摄像头id',
   `picture_type` tinyint(1) NULL DEFAULT NULL COMMENT '图片类型 01-抓拍 02-报警 03-定时',
   `picture_flag` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图片标识',
   `file_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图片路径',
   `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
   `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
   PRIMARY KEY (`id`) USING BTREE,
   INDEX `index_channel`(`channel`) USING BTREE,
   INDEX `index_accessid`(`access_id`) USING BTREE,
   UNIQUE INDEX `index_unique_key`(`unique_key`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '水文图片报-历史记录表' ROW_FORMAT = Dynamic;

-- 图片报-最新记录表
CREATE TABLE `dev_report_pic_last`  (
    `id` bigint(0) NOT NULL COMMENT 'id',
    `unique_key` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联合唯一索引，用于防止重复数据',
    `tenant_id` bigint(0) NULL DEFAULT NULL COMMENT '租户id',
    `access_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备接入id',
    `camera_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '摄像头id',
    `channel` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '通道, 格式为设备accessId_摄像头id',
    `picture_type` tinyint(1) NULL DEFAULT NULL COMMENT '图片类型 01-抓拍 02-报警 03-定时',
    `picture_flag` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图片标识',
    `file_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图片路径',
    `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE,
    INDEX `index_channel`(`channel`) USING BTREE,
    INDEX `index_accessid`(`access_id`) USING BTREE,
    UNIQUE INDEX `index_unique_key`(`unique_key`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '水文图片报-最新记录表' ROW_FORMAT = Dynamic;