M6-T01: add 5 energy tables, models, and migration

- app/models/energy.py: DsmrReading, EnergyContract, EnergyContractVersion,
  TibberPrice, EnergyCostPeriod (per design §3.5; JSON blobs, RESTRICT FKs).
- alembic_app migration 20260623_11_energy_tables (head), env.py imports.
- app_db_adopt APP_BASELINE_REVISION bumped to new head.
- tests/test_energy_models.py + expose_catalog test fixups for new head.
This commit is contained in:
2026-06-23 20:33:35 +02:00
parent 355c8eb8b8
commit 18fe18281b
7 changed files with 1093 additions and 11 deletions
+1 -1
View File
@@ -289,7 +289,7 @@ Phase DAPI + 前端)
> 后端任务沿用校验闸门(`pytest` / `ruff` / 改路由或 schema 则 `export_openapi` 重导出入库);前端闸门见 §8。**不新增依赖**。纯新增、不删/移文件;改 `app/main.py` lifespan 时不得破坏既有 job/连接。
### M6-T01 — 5 张表与模型 `[schema]`
- **Status**: `todo` · **Depends**: none
- **Status**: `done` · **Depends**: none
- **Context**: 单库 app 链新增 5 张表(§3.5)。只建 schema + 模型,不写采集/计算/接口。
- **Files**: `create app/models/energy.py``DsmrReading`/`EnergyContract`/`EnergyContractVersion`/`TibberPrice`/`EnergyCostPeriod`);`create alembic_app/versions/20260623_11_energy_tables.py``modify alembic_app/env.py`、`scripts/app_db_adopt.py``APP_BASELINE_REVISION`→新 head);`create tests/test_energy_models.py`
- **Steps**: