PgDesigner

CLI Reference — PgDesigner PostgreSQL Tools

Usage

pgdesigner [command] [flags] <file>

Input files: .pgd, .pdd, .dbs, .dm2, .sql, or a PostgreSQL connection string. Flags may go before or after file names.

Commands

pgdesigner (no command)

Starts a local server on 127.0.0.1 and opens the visual editor in your default browser. Without a file it shows the Welcome Screen with sample schemas, recent files and import. The server stops when the browser tab closes.

pgdesigner
pgdesigner schema.pgd
pgdesigner "postgres://localhost/mydb" -schema public -full
pgdesigner -read-only -port 8080 schema.pgd
FlagDefaultDescription
-portrandomFixed port for the local server
-read-onlyfalseDisable all write operations (the public demo runs in this mode)
-appfalseOpen in Chrome/Chromium app mode, without the address bar
-schemaallSchemas to read when opening a database (comma-separated)
-fullfalseAlso read views, functions, triggers and types when opening a database

generate

Generate production-ready DDL from a schema file.

pgdesigner generate schema.pgd
pgdesigner generate -o schema.sql schema.pgd
FlagDefaultDescription
-ostdoutOutput .sql file

diff

Compare two schemas and generate ALTER SQL.

pgdesigner diff old.pgd new.pgd
pgdesigner diff -f json old.pgd new.pgd
pgdesigner diff "postgres://localhost/mydb" schema.pgd -o migration.sql

Either side can be a database: diff <dsn> schema.pgd gives the migration from the live database to the model.

FlagDefaultDescription
-fsqlOutput format: sql or json
-ostdoutOutput file; not written when there are no changes

lint

Validate schema against 69 rules.

pgdesigner lint schema.pgd
pgdesigner lint -f json schema.pgd
pgdesigner lint -s error schema.pgd
pgdesigner lint -fix schema.pgd
FlagDefaultDescription
-ftextOutput format: text or json
-sinfoMinimum severity: error, warning, info
-fixfalseAuto-fix fixable issues and save

testdata

Generate realistic INSERT statements.

pgdesigner testdata schema.pgd
pgdesigner testdata -seed 42 -rows 100 schema.pgd
pgdesigner testdata -tables users,orders -o seed.sql schema.pgd
FlagDefaultDescription
-ostdoutOutput .sql file
-seed0 (random)Random seed for reproducibility
-rows50Rows per table
-tablesallComma-separated table names

convert

Import from other formats or live database.

pgdesigner convert schema.pdd -o project.pgd
pgdesigner convert schema.sql -o project.pgd
pgdesigner convert "postgres://localhost/mydb" -o project.pgd
pgdesigner convert "postgres://localhost/mydb" -schema public,billing -full
FlagDefaultDescription
-oinput name + .pgdOutput .pgd file; for a database, <dbname>.pgd in the current directory, which must not exist yet
-schemaallSchemas to read from a database (comma-separated)
-fullfalseAlso read views, functions, triggers, extensions and types from a database

Supported inputs: .pdd (MicroOLAP), .dbs (DbSchema), .dm2 (Toad), .sql (pg_dump), PostgreSQL connection string.

merge

Merge two or more schemas into one .pgd — for example, combine models of separate services, or a model with a fresh import from the database. Inputs can be any supported format; files are merged left to right, and the later file wins on conflicts.

pgdesigner merge -o merged.pgd base.pgd overlay.pgd
pgdesigner merge -o all.pgd -layout base users.pgd billing.sql orders.pdd
FlagDefaultDescription
-omerged.pgdOutput .pgd file
-layoutbothWhere diagram positions come from: both, base or overlay
-namelast file's nameProject name of the result

version

pgdesigner version

Exit codes

CodeMeaning
0Success, including a diff with changes and lint with only warnings or info
1Lint errors found, missing arguments, file not found or parse error
2Unknown flag

Platforms

Single statically-linked binary. No runtime dependencies.

  • macOS amd64 + arm64 (signed, notarized)
  • Linux amd64 + arm64
  • Windows amd64 + arm64