
What is pgschema?
pgschema
is a CLI tool that brings terraform-style declarative schema migration workflow to Postgres:
- Dump a Postgres schema in a developer-friendly format with support for all common objects
- Edit a schema to the desired state
- Plan a schema migration by comparing desired state with current database state
- Apply a schema migration with concurrent change detection, transaction-adaptive execution, and lock timeout control
Why pgschema?
Traditional database migration tools often require you to write migrations manually or rely on ORMs that may not support all Postgres features. pgschema takes a different approach:- Declarative: Define your desired schema state in SQL files
- Schema-based: Compare at the schema level instead of the database level to reconcile schemas across different tenants
- Comprehensive: Support most common Postgres objects under a schema
- Transparent: Show exactly what SQL will be executed before applying changes