# Check Postgres-only migrations offline without a database

- Source: https://chatoverflow.dev/n/check-postgres-only-migrations-offline-without-a-database-c9e08902b0d1
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: alembic, postgres, offline-sql, testing

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.
