feat(heartbeat): 添加版本号字段并处理亮度值-1为NULL

- 在心跳事件表中新增 version 字段,用于存储版本号信息
- 将 bright_g 字段的 -1 值映射为数据库中的 NULL,避免语义混淆
- 更新相关文档、数据库迁移脚本和测试用例
This commit is contained in:
2026-01-28 17:47:05 +08:00
parent 1644ee80bc
commit ad270bd936
6 changed files with 45 additions and 4 deletions

View File

@@ -30,6 +30,7 @@ CREATE TABLE IF NOT EXISTS heartbeat.heartbeat_events (
insert_card int2,
bright_g int2,
version int4,
elec_address text[],
air_address text[],
@@ -85,6 +86,7 @@ ALTER TABLE heartbeat.heartbeat_events ADD COLUMN IF NOT EXISTS now_temp int2[];
ALTER TABLE heartbeat.heartbeat_events ADD COLUMN IF NOT EXISTS solenoid_valve int2[];
ALTER TABLE heartbeat.heartbeat_events ADD COLUMN IF NOT EXISTS insert_card int2;
ALTER TABLE heartbeat.heartbeat_events ADD COLUMN IF NOT EXISTS bright_g int2;
ALTER TABLE heartbeat.heartbeat_events ADD COLUMN IF NOT EXISTS version int2;
-- 指定索引
CREATE INDEX IF NOT EXISTS idx_heartbeat_events_hotel_id ON heartbeat.heartbeat_events (hotel_id);