docs: 更新字段

- 更新数据库schema和文档,增加insert_card和bright_g字段支持
- 同步更新heartbeatProcessor.js和databaseManager.js以支持新字段
This commit is contained in:
2026-01-27 19:49:05 +08:00
parent 1a505bfa29
commit 60eeafcf73
5 changed files with 26 additions and 0 deletions

View File

@@ -98,6 +98,9 @@ class DatabaseManager {
device_count int2 NOT NULL,
comm_seq int4 NOT NULL,
insert_card int2,
bright_g int2,
elec_address text[],
air_address text[],
voltage double precision[],
@@ -148,6 +151,8 @@ class DatabaseManager {
ALTER TABLE heartbeat.heartbeat_events ADD COLUMN IF NOT EXISTS set_temp int2[];
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;
CREATE INDEX IF NOT EXISTS idx_heartbeat_events_hotel_id ON heartbeat.heartbeat_events (hotel_id);
CREATE INDEX IF NOT EXISTS idx_heartbeat_events_power_state ON heartbeat.heartbeat_events (power_state);
@@ -413,6 +418,8 @@ class DatabaseManager {
'carbon_state',
'device_count',
'comm_seq',
'insert_card',
'bright_g',
'elec_address',
'air_address',
'voltage',
@@ -445,6 +452,8 @@ class DatabaseManager {
e.carbon_state,
e.device_count,
e.comm_seq,
e.insert_card ?? null,
e.bright_g ?? null,
Array.isArray(e.elec_address) ? e.elec_address : null,
Array.isArray(e.air_address) ? e.air_address : null,
Array.isArray(e.voltage) ? e.voltage : null,