fix: use sync engine for alembic migration operations

SQLAlchemy 2.0 async engines don't support the sync context manager
protocol needed by alembic. Create a separate sync engine (using
psycopg2) for migration operations while keeping async engine for
application queries.

- Add psycopg2-binary dependency
- Rename async connection variable to avoid mypy confusion
- Use sync engine for MigrationContext and alembic commands
This commit is contained in:
Fusion
2026-05-18 23:09:44 +02:00
parent b9684b0107
commit 1e70462c2b
2 changed files with 43 additions and 30 deletions
+1
View File
@@ -8,6 +8,7 @@ dependencies = [
"uvicorn[standard]>=0.24.0",
"sqlalchemy>=2.0.0",
"asyncpg>=0.29.0",
"psycopg2-binary>=2.9.0",
"alembic>=1.12.0",
"pydantic>=2.5.0",
"pydantic-settings>=2.1.0",