feat(db): init Alembic (async) + SQLAlchemy declarative base — T08

- alembic init -t async migrations
- alembic.ini: dev fallback URL postgresql+asyncpg://…:5433/actcore;
  ACTCORE_DB_URL env var overrides at runtime; src/ added to sys.path
- migrations/env.py: reads ACTCORE_DB_URL, wires target_metadata to Base.metadata
- src/activity_core/db.py: DeclarativeBase subclass + make_engine() helper

Tool choice: Alembic + SQLAlchemy[asyncio] (already declared in pyproject.toml).
Migrations run with: ACTCORE_DB_URL=... alembic upgrade head

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-26 21:45:40 +00:00
parent c39c32abcd
commit f55f497107
6 changed files with 266 additions and 1 deletions

View File

@@ -36,7 +36,7 @@ tasks:
state_hub_task_id: f28a405d-ddcc-44d8-b443-f26f3ab34eaa
- id: T08
title: Choose and configure DB migration tool
status: todo
status: done
state_hub_task_id: d9fe3e54-ec1a-4e23-aa76-d8869f4e024d
- id: T09
title: Write activity_definitions migration