# pgplex/pgschema

Terraform-style, declarative Postgres schema migration. Agent friendly.

Repository: https://github.com/pgplex/pgschema
Canonical: https://ross.abutalabs.com/products/pgschema
Homepage: https://www.pgschema.com
Language: Go
License: Apache-2.0
License Family: permissive
Topics: gitops, postgres, postgresql, schema, schema-migration, schema-migrations, terraform, schema-change, cicd, ddl, devops, multi-tenant, schema-diff, cli
Last push: 2026-09-02T10:55:07+00:00

## Health v2 (maintenance only)
Score: 86/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 100, release rhythm 100, longevity 32
- inputs: {"age_days": 451, "days_push": 0, "days_rel": 3, "gap_med": 9, "n_releases_24m": 34}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1023, forks 60 (observed 2026-09-03T02:15:16.845356+00:00)

## What it is
pgschema is a Go CLI tool that brings Terraform-style declarative schema migration to PostgreSQL: dump the current schema, edit the desired state, then plan and apply the generated DDL. It is Postgres-only with deep support for Postgres-specific objects like RLS policies, partitioned tables, and partial indexes, and requires no shadow database.

## Use cases
- manage postgres schema migrations declaratively like terraform
- replace hand-written flyway or liquibase migration files
- diff edited schema against live database and generate migration DDL
- version-control database schema as plain SQL in git
- reconcile schemas across multi-tenant postgres databases
- apply schema changes safely in CI/CD pipelines
- dump a postgres schema in a clean readable SQL format

## When to choose
- you use PostgreSQL 14+ and want state-based, declarative schema management
- you need Postgres-specific features like RLS, partitioning, and partial indexes tracked in migrations
- you want a free open-source tool with no feature gating and no shadow database infrastructure
- you prefer reviewing generated SQL plans before applying changes

## When to avoid
- you need to manage database-level settings, roles, tablespaces, or extensions
- you use Windows natively (only Linux and macOS are supported)
- you use MySQL, SQL Server, or other non-Postgres databases
- you prefer traditional numbered migration-file workflows

## Facets
- artifact type: cli-tool
- maturity: active
- function: database, infrastructure-as-code, cli, developer-tools, ci-cd
- domain: databases, developer-tools
- platform: cli, go
- tags: postgres, schema-migration, declarative, terraform-style, ddl, schema-diff, gitops, multi-tenant, database-migrations, devops, automation, linux, macos

## Member repositories
- pgplex/pgschema (main) score 86

## Provenance
- Observed fields: from GitHub, fetched 2026-09-03T02:15:16.845356+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T07:11:35.005781+00:00, confidence not recorded.
  - readme: https://github.com/pgplex/pgschema (fetched 2026-09-03T02:15:16.845356+00:00, sha 0b845ddd058c)
  - homepage: https://www.pgschema.com (fetched 2026-08-29T13:10:57.625119+00:00, sha 26c5ef2f17f3)
  - site_page: https://www.pgschema.com/installation (fetched 2026-08-29T13:10:57.634495+00:00, sha 585021b135f4)
  - site_page: https://www.pgschema.com/quickstart (fetched 2026-08-29T13:10:57.636647+00:00, sha d5db44955dd7)
  - site_page: https://www.pgschema.com/faq (fetched 2026-08-29T13:10:57.638529+00:00, sha 7e9c28f4a5d6)
- Data as of 2026-08-30T08:39:29.467469+00:00.
