PgDesigner

PostgreSQL Schema Linter

69 rules catch structural errors, best-practice violations, and PostgreSQL antipatterns — before they reach production.

PgDesigner Check Diagram showing 34 lint issues — 0 errors, 23 warnings, 11 info with fix buttons on Northwind database in light theme

Why lint your schema?

A missing index on a foreign key slows every JOIN. A char(n) column wastes space. A serial instead of identity creates hidden sequences. These aren't bugs — they're design debt that compounds over time. PgDesigner checks for all of them automatically.

69 rules across three severity levels

33 Errors

Structural integrity — FK to missing table, duplicate names, PK column not found, unknown types, empty enums, multiple identity columns.

23 Warnings

Best practices — FK type mismatch, missing FK index, circular FK, no primary key, overlapping indexes, reserved words, PG version compatibility.

13 Info

Antipatterns — char(n) → text, serial → identity, money → numeric, json → jsonb, timestamp → timestamptz, text PKs, too many indexes.

15 rules with one-click autofix

Don't just find problems — fix them. PgDesigner can automatically resolve 15 common issues:

  • Missing FK index — creates a btree index on FK columns
  • No primary key — adds an identity integer PK column
  • Duplicate / overlapping indexes — drops the redundant one
  • char(n) → text, money → numeric, serial → identity, json → jsonb, timestamp → timestamptz, timetz → time
  • FK NO ACTION → RESTRICT, identity with default, generated with default, nullable PK column, duplicate FK

In the UI, click the fix button next to any fixable issue. In the CLI, run pgdesigner lint -fix schema.pgd to apply all fixes at once.

Lints the model, not the migration

Migration linters such as Squawk and Atlas check the SQL you are about to run — locks, rewrites, destructive changes. PgDesigner checks the schema model itself: structure, design and PostgreSQL antipatterns, before any SQL is generated. The two complement each other, and PgDesigner's diff engine adds hazard warnings to every generated migration.

Lint settings live in the model

Ignored rules are stored in the .pgd file and versioned with the schema — project-wide in <lint ignore-rules="W015,I009">, or per table with lint-ignore="…". Everyone on the team, and CI, gets the same result. Rule W021 checks the model against the project's target PostgreSQL version and flags features that version doesn't support yet.

CLI — lint in your pipeline

pgdesigner lint schema.pgd
pgdesigner lint -f json schema.pgd
pgdesigner lint -s error schema.pgd
pgdesigner lint -fix schema.pgd

Exit code 1 if any errors are found — plug it into CI and block merges with broken schemas. Use -f json for machine-readable output, -s error to filter by severity.

UI — navigate and fix

Press Ctrl+L to open Check Diagram. Results are grouped by severity — click any issue to navigate to the problematic object. Autofix button appears next to fixable rules. You can ignore rules per table or globally in project settings.