HB, OTA etc
This commit is contained in:
20
db/migrations/V2__telemetry_data.sql
Normal file
20
db/migrations/V2__telemetry_data.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
CREATE TABLE telemetry_data (
|
||||
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,
|
||||
|
||||
value DOUBLE NOT NULL,
|
||||
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
INDEX idx_device_metric_ts (device_id, metric, ts),
|
||||
INDEX idx_ts (ts),
|
||||
|
||||
FOREIGN KEY (device_id) REFERENCES devices(id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_processed ON telemetry(processed);
|
||||
Reference in New Issue
Block a user