/*
 Navicat Premium Data Transfer

 Source Server Type    : MySQL
 Source Server Version : 80042
 Target Server Type    : MySQL
 Target Server Version : 80042
 File Encoding         : 65001

 Date: 2025-01-01
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for yhy_heartbeat_log
-- ----------------------------
DROP TABLE IF EXISTS `yhy_heartbeat_log`;
CREATE TABLE `yhy_heartbeat_log`  (
  `id` char(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '主键，UUID',
  `data_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '数据类型，固定值：HeartbeatLog',
  `time_stamp` datetime NULL DEFAULT NULL COMMENT '时间戳',
  `device_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '设备号',
  `device_status` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '设备状态（如：Online）',
  `power_status` tinyint(1) NULL DEFAULT 0 COMMENT '电源状态（0-关闭，1-开启）',
  `remain_power` int NULL DEFAULT NULL COMMENT '剩余电量（0-100）',
  `remain_storage_size` bigint NULL DEFAULT NULL COMMENT '剩余存储空间（字节）',
  `heartbeat_time` datetime NULL DEFAULT NULL COMMENT '心跳时间',
  `device_ver` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '设备版本（如：主:1.4.4 音频:1.4.2）',
  `extend` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '扩展信息',
  `body` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '主体信息',
  `created_time` datetime NULL DEFAULT NULL COMMENT '数据创建时间（来自原始数据）',
  `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '系统创建时间',
  `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '系统更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_device_no`(`device_no`) USING BTREE COMMENT '设备号索引',
  INDEX `idx_heartbeat_time`(`heartbeat_time`) USING BTREE COMMENT '心跳时间索引',
  INDEX `idx_time_stamp`(`time_stamp`) USING BTREE COMMENT '时间戳索引',
  INDEX `idx_create_time`(`create_time`) USING BTREE COMMENT '创建时间索引'
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '心跳日志表' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;

