App
pgplex / pgschema
Terraform-style, declarative Postgres schema migration. Agent friendly.
This connects Repowise to pgplex/pgschema's code. It does not install pgschema.
Repowise maps public repos from their source. Not affiliated with pgplex. What is Repowise?
github.com/pgplex/pgschemaIndexed at 319b88c
What is pgschema?
pgschema is a CLI tool that brings Terraform-style declarative schema migration to PostgreSQL. You declare the desired schema state in SQL files, and pgschema generates the migration plan that moves a live database to that state. It is written in Go and can also manage config data such as lookup table rows, settings, and feature flags. To install it, run nix build and follow the steps below. Its code health is 6.9 out of 10 (Fair), ranked #145 of 4,000+ indexed repos. The last commit to pgschema was on Sep 10, 2026, and 26 people have contributed.
As of commit 319b88c, indexed Sep 11, 2026. What it is comes from a model reading the README; the rest is measured from the source and git history, not from the maintainer.
For agentspgschema.md
Repo facts: type, license, health, rank, contributors
| Type | App |
|---|---|
| License | Apache-2.0 |
| Code health | 6.9 / 10 (Fair) |
| Health rank | #145 of 4,000+ indexed repos |
| Last commit | Sep 10, 2026 |
| Contributors | 26 |
| Bus factor | 1 |
| Size | 1,504 files, 78,716 lines |
Install pgschema
Commands copied from the README
- 1Build pgschema with Nix from the flake.
nix build - 2Run pgschema with Nix.
nix run - 3Pass arguments to pgschema through Nix, for example to run the plan command.
nix run . -- plan
Explore pgschema
- DocumentationModule-by-module documentation, 357 pages.
- ArchitectureDependency graph, layers and third-party dependencies.
- Code healthEvery file's score and the findings behind it.
- CommitsEach commit's effect on code health.
- OverviewEverything else the index found: contributors, decisions, what changed this week.
Ask about this code in your agent
This connects Repowise to pgschema's code. It does not install pgschema. To install pgschema, use the install steps.
Useful if you want to change or fork pgschema: your agent can ask how it is put together and get answers that cite its files.
Ask about pgschema
Answers come from pgschema's README and source, with the files they cite. Two free answers a day without an account.
Want this for your own codebase? Map your repo free
About this page
Get a page like this for your own codebase
Repowise built this map of pgplex/pgschema from its source and git history. It parses every symbol, draws the dependency graph, scores each file's health from complexity, duplication, coverage and churn, finds hotspots and owners in the history, and writes documentation for every module. Your coding agent reads the same index over MCP, so its answers cite real files.
Free for 2 public repos, with a page like this one. No card. See how Repowise works
Prefer local? pip install repowise && repowise init indexes your own checkout, no account needed. Star Repowise on GitHub
pgplex/pgschema FAQ
What is pgschema?
pgschema is a CLI tool that brings Terraform-style declarative schema migration to PostgreSQL. You declare the desired schema state and pgschema generates the migration plan automatically.
How does pgschema work?
pgschema dumps the current schema as SQL files, which you edit to the desired state. The plan command diffs the edited schema against the live database, and the apply command executes the resulting DDL.
How do I install pgschema?
pgschema is built and run with Nix using its flake, via nix build or nix run. Windows is not supported, so use WSL or a Linux VM instead. See the install steps
What language is pgschema written in?
pgschema is written in Go, with a small number of shell scripts and Python files.
How is the pgschema code organized?
The cmd directory handles command plumbing, ir inspects and normalizes PostgreSQL catalog objects, and internal/diff computes the differences. main.go is the single entry point.
When should I use pgschema?
Use pgschema when you want to version-control your schema as plain SQL and apply changes declaratively. It suits teams that need Postgres-specific features such as RLS and partitioning tracked in migrations.
What license does pgschema use?
pgschema uses the Apache-2.0 license.
Code health
Hotspots average 2.7, the place fixes pay off most.
On the leaderboards:#14 of 28 Go repos
Key features of pgschema
- Declares the desired schema state and generates the migration plan automatically, instead of requiring hand-written migration files.
- Supports Postgres-specific objects such as row-level security policies, partitioned tables, partial indexes, constraint triggers, identity columns, and column-level grants.
- Uses an embedded Postgres instance to validate changes, so no separate shadow database is needed.
- Manages config data rows listed in pgschema.toml as CSV files and diffs them by primary key.
- Provides a plan step to preview changes before apply, and apply runs with concurrent change detection and lock timeout control.
How pgplex/pgschema works
The entry point main.go starts the program and hands control to the command layer in cmd, which parses CLI input and loads configuration and ignore rules. The ir directory inspects the live PostgreSQL catalog and normalizes objects such as tables and functions into a stable internal representation, with ir/inspector.go and ir/normalize.go doing this work. The internal/diff directory, including internal/diff/diff.go, compares the desired schema with that representation to decide which changes are needed. The internal/color package then colorizes the plan output, and the testutil directory supplies Postgres test instances and fixtures for integration tests.
The codebase has 1,504 files and 2,775 symbols in 7 modules, led by Go, Shell and Python. Code health is 6.8 out of 10, rated fair.
Maintain pgplex/pgschema?
Claim this page, add a badge to the README, or re-index it.
Claim this page
Sign in with GitHub and we check that you are an admin or maintainer of pgplex/pgschema. Then add a badge to the README that links readers here.
Add a badge to your README
Readers click through to this page and can ask pgschema's code a question. A badge also re-indexes the repo every week and marks you as the verified maintainer.
[](https://repowise.dev/repo/pgplex/pgschema?src=badge_ask)Paste it at the top of README.md, under the title.
Added it already? Verify to get the mark now instead of tomorrow.
Need HTML or the larger health card? More formatsHide more formats
This badge as HTML
<a href="https://repowise.dev/repo/pgplex/pgschema?src=badge_ask"><img src="https://api.repowise.dev/badge/wiki/pgplex/pgschema.svg?label=ask" alt="repowise: Ask this codebase"></a>Code health card
The score, its change since the last index, and when it was measured. Follows the reader's light or dark theme.
<a href="https://repowise.dev/repo/pgplex/pgschema?src=badge_card"><picture><source media="(prefers-color-scheme: light)" srcset="https://api.repowise.dev/badge/health/pgplex/pgschema.svg?style=card&theme=light"><img src="https://api.repowise.dev/badge/health/pgplex/pgschema.svg?style=card" alt="repowise code health" width="500" height="168"></picture></a>