update for 4 hour rain forecast
This commit is contained in:
@@ -76,7 +76,8 @@ TimescaleDB schema is initialized from `db/init/001_schema.sql` and includes:
|
||||
- `observations_ws90` (hypertable): raw WS90 observations with payload metadata, plus the full JSON payload (`payload_json`).
|
||||
- `observations_baro` (hypertable): barometric pressure observations from other MQTT topics.
|
||||
- `forecast_openmeteo_hourly` (hypertable): hourly forecast points keyed by `(site, model, retrieved_at, ts)`.
|
||||
- `predictions_rain_1h` (hypertable): model probability + decision + realized outcome fields.
|
||||
- `predictions_rain_1h` (hypertable): legacy 1-hour model probability + decision + realized outcome fields.
|
||||
- `predictions_rain_4h` (hypertable): 4-hour model probability + decision + realized outcome fields.
|
||||
- Continuous aggregates:
|
||||
- `cagg_ws90_1m`: 1‑minute rollups (avg/min/max for temp, humidity, wind, uvi, light, rain).
|
||||
- `cagg_ws90_5m`: 5‑minute rollups (same metrics as `cagg_ws90_1m`).
|
||||
@@ -86,14 +87,18 @@ Retention/compression:
|
||||
- `observations_baro` has a 90‑day retention policy and compression after 7 days.
|
||||
|
||||
### Existing databases
|
||||
If you’re on an existing database, you’ll need to apply the new table definition once (the init SQL only runs on a fresh DB). Example:
|
||||
If you’re on an existing database, apply the 4-hour prediction table migration:
|
||||
|
||||
```sh
|
||||
docker compose exec -T timescaledb psql -U postgres -d micrometeo -f /docker-entrypoint-initdb.d/003_rain_predictions_4h.sql
|
||||
```
|
||||
|
||||
If you also need to backfill older schema objects, you can still re-run:
|
||||
|
||||
```sh
|
||||
docker compose exec -T timescaledb psql -U postgres -d micrometeo -f /docker-entrypoint-initdb.d/001_schema.sql
|
||||
```
|
||||
|
||||
Or copy just the `observations_baro` section into a manual `psql -c`.
|
||||
|
||||
For rain-model monitoring views, also apply `db/init/002_rain_monitoring_views.sql` on existing DBs:
|
||||
|
||||
```sh
|
||||
|
||||
Reference in New Issue
Block a user