PgDesigner

Quick Start — PostgreSQL Schema Designer

This guide takes you from zero to a working schema in 5 minutes.

1. Install

brew tap vmkteam/tap
brew install pgdesigner

Or download the binary for your platform.

2. Open the visual editor

pgdesigner

This starts a local server and opens the ERD editor in your browser. You'll see an empty canvas.

3. Create your first table

  1. Click the +T button in the toolbar (or click on the canvas)
  2. A new table appears with an auto-generated id bigint primary key
  3. Double-click the table name to rename it (e.g., users)
  4. Click the table to open the Table Editor
  5. Add columns: email varchar(255), created_at timestamptz

4. Add a second table with a foreign key

  1. Create another table (e.g., orders)
  2. Click the +FK button in the toolbar
  3. Click orders, then click users
  4. PgDesigner auto-creates a user_id bigint column in orders with a foreign key constraint
PgDesigner ERD canvas with users and orders tables connected by fk_orders_user_id foreign key in light theme

5. Generate SQL

Press Ctrl+G (or menu → Database → Generate DDL):

CREATE TABLE "public"."users" (
  "id" bigint NOT NULL GENERATED ALWAYS AS IDENTITY,
  "email" varchar(255) NOT NULL,
  "created_at" timestamptz NOT NULL DEFAULT now(),
  CONSTRAINT "pk_users" PRIMARY KEY ("id")
);

CREATE TABLE "public"."orders" (
  "id" bigint NOT NULL GENERATED ALWAYS AS IDENTITY,
  "user_id" bigint NOT NULL,
  CONSTRAINT "pk_orders" PRIMARY KEY ("id")
);

ALTER TABLE "public"."orders"
  ADD CONSTRAINT "fk_orders_user_id" FOREIGN KEY ("user_id")
  REFERENCES "public"."users" ("id");

Copy the SQL, save to file, or pipe it directly to psql.

6. Lint your schema

Press Ctrl+L to check for issues. PgDesigner runs 75 rules and reports errors, warnings, and suggestions.

7. Save and commit

Your schema is saved as a .pgd file. Add it to your git repository:

git add myproject.pgd
git commit -m "Initial schema: users + orders"

From now on, every schema change produces a clean single-line diff in your pull requests.

Next steps