pistachio

Declarative PostgreSQL schema management with a plan and apply workflow

Image 1 of 2: Playground with current and desired schemas side by side and the generated ALTER statements below

The desired schema is plain DDL, parsed by PostgreSQL's own parser through pg_query_go. Each run diffs the files against the catalogs and prints the DDL that closes the gap, with no migration history; plan --explain reports scans, rewrites and locks.

  • 1.55 sNo-op plan, 1,000 tables
  • 1.61 sModify plan, 1,000 tbl
  • 0.24 sNo-op plan, 100 tables

Trade-offs

  • No migration history: every run diffs the database against the files. The contract is that dump output fed back to plan shows no changes; other hand-written forms may drift.
  • Renames are never guessed, because a wrong guess drops data: a renamed table reads as a drop and a create until -- pista:renamed-from says otherwise.
  • Extensions, roles and grants are out of scope as a different privilege layer, left to infrastructure tools such as Terraform.

Q&A2

An object removed from the files is dropped only when --allow-drop names its type. Until then the plan shows the drop as a -- skipped: comment.

Reviews

Loading reviews

    More in Migrations

    See all 7 →
    • PaganelData migration engine that verifies the destination down to the row
    • MigrationPilotPostgreSQL migration linter that blocks unsafe DDL before merge
    • FlydbVersioned database migrations with a local GUI, a CLI and agent hand-off
    • pgmoldPostgreSQL schema-as-code in plain SQL, with safety linting and drift checks
    • dbconformFinds and repairs drift between a SQL database and its SQLAlchemy models
    • terradbDeclarative schema management for PostgreSQL and SQLite

    More in Postgres

    See all 25 →
    • SupermetryCookie-free web and product analytics on one Go binary and PostgreSQL
    • arbiterPostgreSQL job queue for Haskell, with no broker and no leader
    • StreambedPostgres-to-Iceberg CDC engine with a built-in Postgres wire query server
    • go-ledgerMulti-tenant double-entry payment ledger API in Go, built in public
    • RRQClosed-loop payment ledger on sharded Postgres with a Kafka outbox
    • pgledgerDouble-entry ledger implemented entirely in PostgreSQL functions and views

    More in CLI tools

    See all 74 →
    • ZeroboxDeny-by-default process sandbox with per-host secret injection
    • blitcpFile copier that reads in disk order, dedupes and streams over raw SSH
    • jc-rsjc rewritten as one static binary that turns command output into JSON
    • quiverDump, load, copy and stream MySQL, MariaDB and TiDB from one consistent snapshot
    • haxMinimalist terminal coding agent written in C
    • roam-codeLocal code index and checks that coding agents can query