{
  "id": 5574856,
  "title": "I built pistachio, a declarative schema tool for PostgreSQL",
  "url": "https://urgent.news/2026/09/04/i-built-pistachio-a-declarative-schema-tool-for-postgresql",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-04T14:24:26.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/winebarrel/i-built-pistachio-a-declarative-schema-tool-for-postgresql-5eh8"
  },
  "original_language": "en",
  "account": "Pistachio is a declarative schema management tool for PostgreSQL developed by the author. Users define their desired schema using SQL, and the CLI generates a DDL diff and applies it using a Terraform-like plan/apply workflow. The tool uses pg_query_go, PostgreSQL's own parser packaged as a library, to parse the schema. This allows pistachio to stay lightweight while still being able to parse PostgreSQL SQL. The desired schema is parsed into the same syntax tree PostgreSQL itself would build, and the current schema is read from pg_catalog. The tool then compares the two schemas and generates the necessary DDL changes. Supported objects include tables, columns, constraints, indexes, views, materialized views, enums, domains, composite types, sequences, row-level security and policies, triggers, comments, storage parameters, functions, and procedures. Pistachio also supports renaming objects using the --pista:renamed-from directive. To adopt pistachio on an existing database, users can run pista dump schema.sql and edit that file moving forward. Pistachio does not manage CREATE EXTENSION, CREATE ROLE, or GRANT statements, or objects created by these statements. It also does not drop unsupported statements silently, instead issuing a warning for them. Pistachio can be installed using brew or by grabbing a binary from the releases page, and there is a demo image available with Docker that bundles PostgreSQL with a sample schema.",
  "summary": "I built pistachio , a declarative schema management tool for PostgreSQL. You write the schema you want in SQL, and the CLI generates the DDL diff against the current database and applies it in a Terraform-like plan/apply workflow. CREATE TABLE public . users ( id integer NOT NULL , name text NOT NULL , email text NOT NULL , -- added this line CONSTRAINT users_pkey PRIMARY KEY ( id ) ); Add that…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}