<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Getting Started on DPG — Declarative PG</title><link>https://thec1oud.github.io/dpg/docs/getting-started/</link><description>Recent content in Getting Started on DPG — Declarative PG</description><generator>Hugo</generator><language>en</language><atom:link href="https://thec1oud.github.io/dpg/docs/getting-started/index.xml" rel="self" type="application/rss+xml"/><item><title>Installation</title><link>https://thec1oud.github.io/dpg/docs/getting-started/installation/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://thec1oud.github.io/dpg/docs/getting-started/installation/</guid><description>&lt;h2 id="system-requirements">System Requirements&lt;/h2>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>Requirement&lt;/th>
 &lt;th>Minimum&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>PostgreSQL target&lt;/td>
 &lt;td>14 or later&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>OS&lt;/td>
 &lt;td>Linux (amd64/arm64), macOS (amd64/arm64), Windows (amd64)&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;p>To build from source, a C compiler (GCC or Clang) and Go 1.25+ are also required — see &lt;a href="#build-from-source">Build from Source&lt;/a> below.&lt;/p>
&lt;hr>
&lt;h2 id="install-from-binary">Install from Binary&lt;/h2>
&lt;h3 id="one-line-install-linux--macos">One-line install (Linux / macOS)&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>curl -fsSL https://raw.githubusercontent.com/thec1oud/dpg/master/scripts/install.sh &lt;span style="color:#1f2328">|&lt;/span> bash
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>This downloads the correct pre-built binary for your platform and installs it to &lt;code>/usr/local/bin&lt;/code> (if &lt;code>sudo&lt;/code> is available) or &lt;code>~/.local/bin&lt;/code> (otherwise).&lt;/p></description></item><item><title>Introduction</title><link>https://thec1oud.github.io/dpg/docs/getting-started/introduction/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://thec1oud.github.io/dpg/docs/getting-started/introduction/</guid><description>&lt;p>DPG is a declarative, state-based superset of PostgreSQL SQL. You describe what your database &lt;em>should be&lt;/em>; the compiler figures out what needs to change and generates the minimal, safe set of DDL statements to reach that state.&lt;/p>
&lt;h2 id="the-problem-with-imperative-migrations">The problem with imperative migrations&lt;/h2>
&lt;p>PostgreSQL DDL is fundamentally imperative. Migration files describe &lt;em>actions taken at a point in time&lt;/em>, not the &lt;em>current intended state&lt;/em> of the database:&lt;/p>
&lt;ul>
&lt;li>Drift accumulates as production databases are patched and hotfixed outside the migration history.&lt;/li>
&lt;li>To understand the current schema, you must mentally replay every migration file from the beginning.&lt;/li>
&lt;li>Running a migration file twice will fail or corrupt state — idempotency is never guaranteed.&lt;/li>
&lt;li>&lt;code>ALTER TABLE public.users ADD CONSTRAINT ...&lt;/code> re-states the schema and table name in every alteration, even though the context is already known.&lt;/li>
&lt;/ul>
&lt;h2 id="the-dpg-answer">The DPG answer&lt;/h2>
&lt;p>Instead of writing commands, you write a description of the desired state. The compiler compares that description against a committed snapshot and generates the precise SQL delta. If the database already matches the description, the output is empty.&lt;/p></description></item><item><title>Quick Start</title><link>https://thec1oud.github.io/dpg/docs/getting-started/quick-start/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://thec1oud.github.io/dpg/docs/getting-started/quick-start/</guid><description>&lt;h2 id="core-concepts-in-90-seconds">Core Concepts in 90 Seconds&lt;/h2>
&lt;p>&lt;strong>Offline-first.&lt;/strong> &lt;code>dpg plan&lt;/code> and &lt;code>dpg diff&lt;/code> never touch a database. They compare &lt;code>.dpg&lt;/code> source files against a committed snapshot. CI pipelines can review migrations before any database is reached.&lt;/p>
&lt;p>&lt;strong>Idempotent.&lt;/strong> Applying the same plan twice produces zero SQL on the second run.&lt;/p>
&lt;p>&lt;strong>Safety-classified.&lt;/strong> Every generated statement is tagged &lt;code>SAFE&lt;/code>, &lt;code>CAUTION&lt;/code>, or &lt;code>DESTRUCTIVE&lt;/code>. Destructive operations are blocked by default; they require &lt;code>--allow-destructive&lt;/code> to proceed.&lt;/p>
&lt;p>&lt;strong>Additive grants.&lt;/strong> DPG only emits &lt;code>GRANT&lt;/code>. It never auto-revokes. Removing a &lt;code>GRANTS&lt;/code> entry emits nothing — write an explicit &lt;code>REVOKES { }&lt;/code> block to revoke.&lt;/p></description></item><item><title>Development Guide</title><link>https://thec1oud.github.io/dpg/docs/getting-started/development/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://thec1oud.github.io/dpg/docs/getting-started/development/</guid><description>&lt;p>Everything needed to build, test, and contribute to DPG.&lt;/p>
&lt;hr>
&lt;h2 id="prerequisites">Prerequisites&lt;/h2>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>Tool&lt;/th>
 &lt;th>Minimum version&lt;/th>
 &lt;th>Required for&lt;/th>
 &lt;th>Notes&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>Go&lt;/td>
 &lt;td>1.25.6&lt;/td>
 &lt;td>Building&lt;/td>
 &lt;td>Must match &lt;code>go.mod&lt;/code>; download from go.dev&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>GCC or Clang&lt;/td>
 &lt;td>any&lt;/td>
 &lt;td>Building&lt;/td>
 &lt;td>CGo required by &lt;code>pg_query_go&lt;/code> (libpg_query C parser)&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>Git&lt;/td>
 &lt;td>2.x&lt;/td>
 &lt;td>Everything&lt;/td>
 &lt;td>&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>Docker&lt;/td>
 &lt;td>20.x&lt;/td>
 &lt;td>Integration tests&lt;/td>
 &lt;td>Daemon must be running; pulls &lt;code>postgres:16-alpine&lt;/code>&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>Hugo extended&lt;/td>
 &lt;td>0.147.0&lt;/td>
 &lt;td>Docs site&lt;/td>
 &lt;td>Must be the &lt;strong>extended&lt;/strong> variant for Sass/SCSS&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>Node.js&lt;/td>
 &lt;td>20+&lt;/td>
 &lt;td>Docs site&lt;/td>
 &lt;td>PostCSS dependency for Docsy theme&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>npm&lt;/td>
 &lt;td>10+&lt;/td>
 &lt;td>Docs site&lt;/td>
 &lt;td>Ships with Node.js&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>staticcheck&lt;/td>
 &lt;td>latest&lt;/td>
 &lt;td>&lt;code>make lint&lt;/code>&lt;/td>
 &lt;td>&lt;code>go install honnef.co/go/tools/cmd/staticcheck@latest&lt;/code>&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;blockquote>
&lt;p>&lt;strong>Why CGo?&lt;/strong> &lt;code>pg_query_go&lt;/code> wraps libpg_query — the real PostgreSQL C parser extracted into a standalone library. DPG uses it so that every &lt;code>.dpg&lt;/code> file is parsed by the exact same grammar as PostgreSQL itself. This rules out pure-Go cross-compilation; each target platform must be built natively on that architecture. The release CI uses platform-matched runners (&lt;code>ubuntu-24.04-arm&lt;/code> for linux/arm64, &lt;code>macos-latest&lt;/code> for darwin/arm64).&lt;/p></description></item><item><title>Editor Integration</title><link>https://thec1oud.github.io/dpg/docs/getting-started/editor-integration/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://thec1oud.github.io/dpg/docs/getting-started/editor-integration/</guid><description>&lt;p>DPG ships native plugins for VS Code, Neovim, Helix, and JetBrains IDEs. Each plugin provides:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Syntax highlighting&lt;/strong> — via the DPG tree-sitter grammar&lt;/li>
&lt;li>&lt;strong>Diagnostics, hover, go-to-definition, completions&lt;/strong> — powered by &lt;code>dpg-lsp&lt;/code>&lt;/li>
&lt;li>&lt;strong>Format on save&lt;/strong> — runs &lt;code>dpg fmt&lt;/code> before each write&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h2 id="prerequisites">Prerequisites&lt;/h2>
&lt;h3 id="dpg">dpg&lt;/h3>
&lt;p>&lt;code>dpg&lt;/code> must be on your &lt;code>PATH&lt;/code>. See &lt;a href="./installation">Installation&lt;/a>.&lt;/p>
&lt;h3 id="dpg-lsp">dpg-lsp&lt;/h3>
&lt;p>&lt;code>dpg-lsp&lt;/code> is the language server that powers diagnostics, hover, and completions. Install it once and all editors share it:&lt;/p></description></item></channel></rss>