This guide takes you from zero to a working schema in 5 minutes.
brew tap vmkteam/tap
brew install pgdesigner Or download the binary for your platform.
pgdesigner This starts a local server and opens the ERD editor in your browser. You'll see an empty canvas.
id bigint primary keyusers)email varchar(255), created_at timestamptzorders)orders, then click usersuser_id bigint column in orders with a foreign key constraint
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.
Press Ctrl+L to check for issues. PgDesigner runs 75 rules and reports errors, warnings, and suggestions.
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.