Migrate poo recorder and align Alembic naming

This commit is contained in:
2026-04-20 11:48:48 +02:00
parent e334df992f
commit 044b47c573
34 changed files with 1138 additions and 31 deletions
+10 -9
View File
@@ -11,6 +11,7 @@
- SQLite + SQLAlchemy + Alembic 基础设施
- 极简 server-side templates
- location recorder 第一版迁移
- poo recorder 第一版迁移
- Home Assistant outbound integration layer
- Home Assistant inbound gateway 第一版
- pytest 测试基础
@@ -20,7 +21,6 @@
当前阶段明确不包含:
- TickTick 业务逻辑迁移
- poo records 业务迁移
- Notion 模块
当前 Home Assistant inbound gateway 仅接回第一版:
@@ -42,21 +42,22 @@ Notion 在 Go 版本中仍然存在,但已被明确视为 legacy / removed sco
当前系统仍然是两个独立的 SQLite 数据库文件,而不是单一数据库:
- `location` 模块使用自己的 DB 文件
- `poo` 模块未来也将使用自己的 DB 文件
- `poo` 模块使用自己的 DB 文件
当前阶段明确不借这次重构把两个 DB 合并。配置层已经显式反映这一点:
- `LOCATION_DATABASE_URL`
- `POO_DATABASE_URL`
目前真正接入的是 `location` 对应的数据库;`poo` 先保留配置占位,等模块迁入时再接上
目前 `location` `poo` 都已经接到各自独立的数据库文件
## 当前目录
Python 骨架的主要目录如下:
- `app/`: FastAPI 应用代码
- `alembic/`: Alembic migration 环境
- `alembic_location/`: Location DB 的 Alembic migration 环境
- `alembic_poo/`: Poo DB 的 Alembic migration 环境
- `tests/`: pytest 测试
- `docs/`: 架构说明与迁移文档
- `scripts/`: 辅助脚本,例如 OpenAPI 导出
@@ -129,12 +130,12 @@ uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
初始化 migration 环境后,可继续添加模型并生成迁移:
```bash
alembic revision --autogenerate -m "init tables"
alembic upgrade head
```
当前 `location``poo` 都已经有各自独立的 Alembic baseline / 接管链路。
当前 Alembic 只接管 `location` 这条链路;`poo` 相关数据库与 migration 还没有迁入。
- Location Alembic 环境:`alembic_location.ini` + `alembic_location/`
- Poo Alembic 环境:`alembic_poo.ini` + `alembic_poo/`
- Location DB 接管 / 初始化:`python scripts/location_db_adopt.py`
- Poo DB 接管 / 初始化:`python scripts/poo_db_adopt.py`
## 运行测试