// the find
pgplex/pgschema
Terraform-style, declarative Postgres schema migration. Agent friendly.
pgschema brings Terraform-style declarative schema management to Postgres — you edit a SQL file describing what the schema should look like, and it generates the DDL to get there. It's for teams who want schema-as-code without the migration file ceremony of Flyway or Liquibase. Backed by Bytebase, free, Apache 2.0.
The Postgres-specific coverage is genuinely impressive: RLS policies, partitioned tables, partial indexes, column-level grants, default privileges, domain types — things Atlas handles only partially and generic tools skip entirely. No shadow database requirement is a real operational win; it spins up an embedded Postgres internally and tears it down, so you don't need to maintain a parallel instance in CI. The plan/apply split with JSON output means you can gate migrations in CI on a human-readable diff before anything touches production. The test suite uses testcontainers against a real Postgres rather than mocks, which means the diff logic is actually validated against the engine it targets.
Windows is unsupported with no roadmap — WSL is the workaround, which is fine for local dev but awkward in Windows-native CI pipelines. The embedded Postgres approach for validation works but means the binary carries a non-trivial runtime dependency; if the embedded version lags behind your production Postgres version, plan output can silently diverge from what the real server would accept. There's no rollback story built in — the docs mention it but the answer is essentially 'write a reverse schema file', which puts the burden back on you. Multi-schema support exists but the tool is single-schema per invocation, so databases with many schemas (SaaS tenants, complex monoliths) require orchestration scripts that aren't provided.