* fix(migrations): use HINDSIGHT_API_MIGRATION_DATABASE_URL when set Session-level advisory locks are broken when the database URL goes through PgBouncer in transaction mode: the backend connection is returned to the pool on COMMIT, orphaning the lock, so multiple pods can simultaneously run migrations for the same schema. When HINDSIGHT_API_MIGRATION_DATABASE_URL is set, use it for both the advisory lock connection and the Alembic run. Callers should point this at the direct PostgreSQL endpoint (bypassing the pooler) so the session-level lock is held for the full migration duration. * refactor(migrations): move MIGRATION_DATABASE_URL to standard config Wire HINDSIGHT_API_MIGRATION_DATABASE_URL through HindsightConfig instead of reading os.getenv() directly in migrations.py. Add the field to the dataclass, from_env(), log_config(), all call sites, .env.example, and the configuration docs page. * fix: update test mocks for migration_database_url kwarg and regenerate docs skill --------- Co-authored-by: Nicolò Boschi <boschi1997@gmail.com> |
||
|---|---|---|
| .. | ||
| developer | ||
| sdks | ||