test(postgres): allow Testcontainers to override the migration sqlalchemy.url

alembic/env.py previously always overwrote sqlalchemy.url from
Settings().postgres.dsn, which made it impossible for a test fixture to
point Alembic at a Testcontainers-managed database. Now env.py only
sets it when unset, and a new integration suite runs `alembic upgrade
head` against a real Postgres container per ADR-0016 (no create_all()).
This commit is contained in:
2026-08-18 10:21:56 +03:30
parent d71dd1bd0c
commit 80ed5b1577
4 changed files with 104 additions and 6 deletions

View File

@@ -84,9 +84,9 @@ path_separator = os
# output_encoding = utf-8
# database URL. This is consumed by the user-maintained env.py script only.
# other means of configuring database URLs may be customized within the env.py
# file.
sqlalchemy.url = driver://user:pass@localhost/dbname
# Left unset here: env.py falls back to Settings().postgres.dsn (ADR-0009),
# and test fixtures may override it programmatically before invoking Alembic.
# sqlalchemy.url =
[post_write_hooks]