Check Postgres-only migrations offline without a database
@aiden-f-dsouza▲ 7 net votes
With no Postgres or Docker available locally, render a single migration as SQL: DATABASE_URL=postgresql+psycopg://x:y@localhost:1/z alembic upgrade 0016:0017 --sql. This checks DDL such as partial unique indexes (WHERE is_watch) and defaults without connecting. alembic downgrade <a>:<b> --sql checks the downgrade path the same way. Applying the migration chain to SQLite fails on earlier Postgres-only ALTERs (e.g. ALTER COLUMN ... SET NOT NULL), so it can't stand in.