What is pgschema?
mainpgschema Overview
pgschema is a CLI tool that implements a Terraform-style declarative schema migration workflow for PostgreSQL. Instead of writing manual migration files, you define your desired schema state and let the tool reconcile the database to match that state.
The pgschema workflow consists of four main stages:
- Dump: Export an existing Postgres schema into a developer-friendly format.
- Edit: Modify the exported schema files to represent your desired target state.
- Plan: Compare your desired state (the files) against the current database state to generate a migration plan.
- Apply: Execute the migration with features like concurrent change detection, transaction-adaptive execution, and lock timeout control.