PostgreSQL schema diff — free to use

PostgreSQL Schema Diff.
Generate migrations.
Zero setup.

Paste two pg_dump --schema-only outputs. Spot every table, column, index, and constraint change instantly. Get ready-to-run ALTER TABLE scripts for PostgreSQL — all in your browser.

No account required. No data leaves your device.

Built for PostgreSQL workflows

SchemaLens understands PostgreSQL-specific syntax that generic diff tools miss.

🐘

SERIAL & Identity Columns

Correctly detects SERIAL, BIGSERIAL, and GENERATED ALWAYS AS IDENTITY changes across schema versions.

📦

Enum Types

Diffs CREATE TYPE ... AS ENUM statements. Catches added or removed enum values before they break your app.

🔑

Constraints & Indexes

Primary keys, unique constraints, foreign keys, CHECK constraints, and partial indexes — all compared semantically, not by raw text.

📝

Quoted Identifiers

Handles double-quoted identifiers ("User") and mixed-case table names exactly like PostgreSQL does.

Array & JSONB Columns

Recognizes INTEGER[], TEXT[], JSONB, and warns when these advanced types appear so nothing slips through.

🔒

Privacy First

Your schema never leaves the browser. Compare production schemas safely without uploading sensitive table structures to a third-party server.

How it works

1

Export your schemas

Run pg_dump --schema-only --no-owner --no-privileges old_db > old.sql on both databases.

2

Paste into SchemaLens

Copy the SQL into the two editor panes. Dialect is automatically set to PostgreSQL.

3

Review the diff

See added tables, dropped columns, type changes, and constraint modifications highlighted in color.

4

Copy the migration

Export ALTER TABLE scripts, save as Markdown, PDF, or raw SQL. Run in staging, then production.

PostgreSQL migration examples

SchemaLens generates production-ready ALTER TABLE scripts for every change it detects.

Column type change

ALTER TABLE "users"
  ALTER COLUMN "bio" TYPE VARCHAR(500);

Add a new column

ALTER TABLE "orders"
  ADD COLUMN "shipped_at" TIMESTAMP;

Add a foreign key

ALTER TABLE "comments"
  ADD CONSTRAINT "fk_comments_post"
  FOREIGN KEY ("post_id") REFERENCES "posts"("id");

Set a default value

ALTER TABLE "tasks"
  ALTER COLUMN "status" SET DEFAULT 'pending';

Related guides

Ready to diff your PostgreSQL schemas?

Join thousands of developers who use SchemaLens to catch schema changes before they hit production.

Start Comparing Free

Free for up to 10 tables. Pro starts at $12/mo.