add sensors to migration

This commit is contained in:
Pedro Pérez 2025-10-10 01:46:08 +02:00
parent 1f6d0a58e7
commit 57254fcbc9
2 changed files with 12 additions and 2 deletions

View File

@ -47,7 +47,8 @@ por el puesto de programador Go.
### Obtener valores de un sensor
- Campo obligatorio: `sensor_id`.
- Campos opcionales: `from` y `to` en formato RFC3339. Si no se especifican, se toman los últimos 7 días.
- Campos opcionales: `from` y `to` en formato RFC3339. Si no se especifican,
se toman los últimos 7 días.
`nats req sensors.values.get '{
"sensor_id": "sensor-001",

View File

@ -34,4 +34,13 @@ create table registry
timescaledb.hypertable,
timescaledb.partition_column = 'created_at',
timescaledb.segmentby = 'sensor_id'
);
);
insert into sensors (sensor_id, sensor_type, sampling_interval, threshold_above, threshold_below)
values
('temp-001', 'temperature', 10, 100, 0),
('hum-001', 'humidity', 15, 80, 20),
('co2-001', 'carbon_dioxide', 20, 1000, 400),
('pres-001', 'pressure', 30, 1050, 950),
('prox-001', 'proximity', 5, 200, 0),
('light-001', 'light', 10, 10000, 0);