- websocket client on ESP32
- telemetry protocol builder - server-side message handling - database migrations - telemetry persistence
This commit is contained in:
20
db/migrations/V1__init_protocol.sql
Normal file
20
db/migrations/V1__init_protocol.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
CREATE TABLE devices (
|
||||
id BIGINT PRIMARY KEY,
|
||||
is_enabled BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE telemetry (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
device_id BIGINT NOT NULL,
|
||||
ts BIGINT NOT NULL,
|
||||
metric VARCHAR(32) NOT NULL,
|
||||
source VARCHAR(64) NOT NULL,
|
||||
unit VARCHAR(16) NOT NULL,
|
||||
payload JSON NOT NULL,
|
||||
processed BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (device_id) REFERENCES devices(id)
|
||||
);
|
||||
Reference in New Issue
Block a user