What is DPG?

DPG is a schema compiler and migration tool for PostgreSQL. You describe what your database should be; DPG figures out what needs to change and generates the minimal, safe SQL migration.

TABLE users (
    id   BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
    name TEXT NOT NULL,
    email TEXT NOT NULL
) {
    INDICES { UNIQUE users_email_idx (email); }
    GRANTS { SELECT, INSERT TO app_role; }
}

Run dpg plan to see the SQL diff. Run dpg apply to execute it.


Key Features

  • Offline-firstdpg plan and dpg diff never require a live database
  • Safe by default — destructive operations are blocked unless explicitly permitted
  • Snapshot-driven — the committed snapshot is the source of truth, not the live DB
  • Zero new syntax — DPG extends valid PostgreSQL DDL; no new language to learn
  • Plugin API — extend the pipeline via pkg/dpg (linters, snapshot stores, apply executors)

InstallationBuild from source, system requirements
Quick StartYour first DPG project in 5 minutes
CLI ReferenceAll commands with flags
Language ReferenceTwo-part syntax, merge rules, structural scoping
Plugin APIExtend DPG via the public Go API
RFC DPG-001Full specification