add sensors to migration
This commit is contained in:
parent
1f6d0a58e7
commit
57254fcbc9
@ -47,7 +47,8 @@ por el puesto de programador Go.
|
|||||||
### Obtener valores de un sensor
|
### Obtener valores de un sensor
|
||||||
|
|
||||||
- Campo obligatorio: `sensor_id`.
|
- 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 '{
|
`nats req sensors.values.get '{
|
||||||
"sensor_id": "sensor-001",
|
"sensor_id": "sensor-001",
|
||||||
|
|||||||
@ -34,4 +34,13 @@ create table registry
|
|||||||
timescaledb.hypertable,
|
timescaledb.hypertable,
|
||||||
timescaledb.partition_column = 'created_at',
|
timescaledb.partition_column = 'created_at',
|
||||||
timescaledb.segmentby = 'sensor_id'
|
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);
|
||||||
Loading…
Reference in New Issue
Block a user