PgDesigner

Git-Friendly Schema Format

Review schema changes like code — clean diffs, meaningful context, migrations straight from git history.

The problem with other tools

pgModeler keeps the whole model in one large XML file (split models are a paid Plus feature). DrawDB dumps everything into a single JSON blob. dbdiagram.io doesn't even give you a local file. Reviewing these diffs in a pull request is painful.

One column = one line in the diff

PgDesigner's .pgd format is XML designed specifically for version control. Each column is one line with all attributes inline, and tables are written in a stable order:

<schema name="public">
  <table name="orders">
    <column name="id" type="bigint">
      <identity generated="by-default"></identity>
    </column>
    <column name="user_id" type="bigint" nullable="false"></column>
    <column name="total" type="numeric" precision="10" scale="2" nullable="false"></column>
    <pk name="orders_pkey">
      <column name="id"></column>
    </pk>
    <fk name="fk_orders_user_id" to-table="users" on-delete="no action" on-update="no action">
      <column name="user_id" references="id"></column>
    </fk>
  </table>
</schema>

Adding a column produces exactly one line in git diff:

    <column name="user_id" type="bigint" nullable="false"></column>
+   <column name="status" type="varchar" length="20"></column>
    <column name="total" type="numeric" precision="10" scale="2" nullable="false"></column>

Closing tags like </table> give context in diffs — you always know which table was changed, unlike JSON's anonymous closing braces.

Why not HCL, DBML, or JSON?

vs pgModeler XML

One large file per model; splitting it requires the paid Plus edition.

vs DrawDB JSON

Single JSON blob — entire file shows as changed. No meaningful context.

vs Atlas HCL

Clean diffs, but no visual editor. CLI-only workflow.

vs dbdiagram DBML

Text-based and git-friendly, but SaaS — no local files unless you export.

From git history to a migration

Because the model lives in git, any two commits are two schemas. Feed them to pgdesigner diff and you get the ALTER script between them, with hazard warnings:

git show main:schema.pgd > /tmp/main.pgd
pgdesigner diff /tmp/main.pgd schema.pgd -o migration.sql

Run pgdesigner lint schema.pgd in the same pipeline — it exits with code 1 when the schema has errors.