Problem
tests/migrations/test_migration_integration.py cannot currently run the complete PostgreSQL Alembic history against a schema pre-created from current SQLAlchemy metadata. The owner-aware UserOAuth migration test therefore stamps the database to its immediate parent before running the target revision.
This avoids unrelated failures in older revisions, but it no longer verifies full-chain re-run and Alembic version stability for this path.
A likely incompatibility is the conditional foreign-key creation in c7dfa28cc67a_add_user_oauth_table.py. Other historical revisions may have similar assumptions about an empty or revision-matched schema.
Desired outcome
- Identify the historical revisions that fail when the current metadata schema already exists.
- Define whether pre-created-current-metadata plus full-history migration is a supported contract.
- If supported, make the affected revisions idempotent without changing fresh-database behavior.
- Restore a PostgreSQL integration test that runs the full migration chain and verifies a second run is stable.
- Document any intentionally unsupported initialization path if the contract is rejected.
Context
Tracked from review feedback on #1529. This is pre-existing migration-chain maintenance and is intentionally kept outside that PR.
Problem
tests/migrations/test_migration_integration.pycannot currently run the complete PostgreSQL Alembic history against a schema pre-created from current SQLAlchemy metadata. The owner-awareUserOAuthmigration test therefore stamps the database to its immediate parent before running the target revision.This avoids unrelated failures in older revisions, but it no longer verifies full-chain re-run and Alembic version stability for this path.
A likely incompatibility is the conditional foreign-key creation in
c7dfa28cc67a_add_user_oauth_table.py. Other historical revisions may have similar assumptions about an empty or revision-matched schema.Desired outcome
Context
Tracked from review feedback on #1529. This is pre-existing migration-chain maintenance and is intentionally kept outside that PR.