feat(server): heartbeat-diagnostics stub + migration for real server import
The real server lives in a separate repo; this repo carries reference stubs for each endpoint (see camera_endpoint.py precedent). Adds the Pydantic extension, persistence helper, migration 005, and tests that the real server can copy when adding diagnostic-field support. Matches the firmware v1.1.0 heartbeat payload shape. Old-shape payloads (firmware v1.0.0) continue to parse cleanly with the new fields defaulting to None.
This commit is contained in:
14
server/migrations/005_heartbeat_diagnostics.sql
Normal file
14
server/migrations/005_heartbeat_diagnostics.sql
Normal file
@@ -0,0 +1,14 @@
|
||||
-- migrations/005_heartbeat_diagnostics.sql
|
||||
-- Add v1.1.0 diagnostic columns to the existing heartbeats table.
|
||||
-- Adjust the table name ("heartbeats") to match the real server's schema.
|
||||
-- Apply: sqlite3 <db_file> < migrations/005_heartbeat_diagnostics.sql
|
||||
--
|
||||
-- sqlite's ALTER TABLE ADD COLUMN only takes one column per statement, so
|
||||
-- each field is added separately. All columns are nullable, so firmware
|
||||
-- v1.0.0 payloads (which omit these fields) remain accepted unchanged.
|
||||
|
||||
ALTER TABLE heartbeats ADD COLUMN reset_reason INTEGER;
|
||||
ALTER TABLE heartbeats ADD COLUMN heap_free INTEGER;
|
||||
ALTER TABLE heartbeats ADD COLUMN heap_min_free INTEGER;
|
||||
ALTER TABLE heartbeats ADD COLUMN last_disconnect_code INTEGER;
|
||||
ALTER TABLE heartbeats ADD COLUMN recent_events TEXT; -- JSON-serialized list of {t,d0,d1,ts,up}
|
||||
Reference in New Issue
Block a user