# pgschema

> Terraform-style declarative schema migrations for PostgreSQL: dump, edit, plan, apply

Source: https://talira.ai/catalog/pgschema-zs6w461m
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Command-line tool
- Categories: [developer tools / database / migrations](https://talira.ai/categories/developer-tools/database/migrations), [databases / postgres / migration](https://talira.ai/categories/databases/postgres/migration)
- Licence: Apache-2.0[^2]
- Pricing: Free and open source[^1]
- Pricing notes: Free and open source, with no feature gating.
- Free tier: yes[^1]
- Backed by: [Bytebase](https://talira.ai/orgs/bytebase.md)

A CLI for declarative schema migrations on PostgreSQL, from the pgplex toolchain backed by [Bytebase](https://talira.ai/catalog/bytebase-m5d8k3mk.md). You dump the live schema as SQL files, edit them to the state you want, and pgschema plans the DDL by diffing against the database, then applies it with concurrent change detection and lock timeout control. There's no migration history table and no shadow database: it validates with an embedded Postgres instance. Being Postgres-only, it tracks objects generic tools skip, such as row-level security policies, partitioned tables, partial indexes, constraint triggers and column-level grants. Apache 2.0, with no feature gating.

## Links

- Website: https://www.pgschema.com/
- GitHub: https://github.com/pgplex/pgschema
- Docs: https://www.pgschema.com/

## Problems it solves

- generate Postgres migrations from my edited schema file like terraform plan
- track row-level security policies and grants in my schema migrations
- preview the exact DDL before changing a production Postgres schema

## Features

- dump a Postgres schema as SQL files
- plan migration DDL by diffing a schema file against the live database
- apply with concurrent change detection and lock timeouts
- row-level security, partitioning, triggers and grants tracked
- no shadow database (embedded Postgres)
- docs for use from a coding agent

## Trust

Overall: 0.63 out of 1.
Signals: maintenance 1.00, adoption 0.61, momentum 0.54, community 0.61, backing 0.30, extensibility 0.00.

- last commit 7 days ago
- 80 commits in the last 90 days
- latest release v1.15.0 7 days ago
- 1.1k GitHub stars
- 33 contributors
- backed by Bytebase

## Alternatives

- [Atlas](https://talira.ai/catalog/atlas-vjsak9tx.md): Database schema as code: plan, lint, test and apply schema migrations, like Terraform for databases
- [sqldef](https://talira.ai/catalog/sqldef-0273hr6q.md): Idempotent schema management in plain SQL for MySQL, PostgreSQL, SQLite and SQL Server
- [Reylo](https://talira.ai/catalog/reylo-0v2g7263.md): Import .sql files into TypeScript with types inferred from your live database, plus SQL-first migrations
- [Reshape](https://talira.ai/catalog/reshape-g9t6827t.md): An easy-to-use, zero-downtime schema migration tool for Postgres
- [pgroll](https://talira.ai/catalog/pgroll-gdjd3cnf.md): Zero-downtime, reversible schema migrations for Postgres
- [Flyway](https://talira.ai/catalog/flyway-nkthpjjz.md): Versioned SQL database migrations for 50+ databases, open source with Redgate's enterprise editions

## Sources

[^1]: https://github.com/pgplex/pgschema#readme (checked 24 Nov 2026)
[^2]: https://github.com/pgplex/pgschema/blob/main/LICENSE (checked 24 Nov 2026)
