Two schemas in, safe ALTER migration out — with hazard warnings before anything hits production.
Every migration tool generates ALTER TABLE. Few tell you that your ALTER COLUMN TYPE will lock the table for 20 minutes, or that ADD COLUMN NOT NULL without a DEFAULT will fail on existing rows. PgDesigner does both — generates the SQL and warns you about the risks.
Give it two .pgd models — old and new. The engine computes every structural change and emits safe ALTER statements in the correct dependency order.
Reverse dependency order: FK → indexes → columns → tables. Nothing breaks because dependents are removed first.
Forward dependency order: enums → tables → columns → PK → indexes → FK. References always exist before they're needed.
Model vs Model
Edit your .pgd, get the migration script instantly.
DB vs Model
pg_dump → convert → compare with your model.
Git versions
Two versions of .pgd from git history → ALTER patch.
Live preview
Press Ctrl+D to see ALTER SQL for unsaved changes.
Every generated ALTER is analyzed for operational hazards. The diff engine emits a comment with the hazard level and code directly before the SQL statement.
Compatible type casts (varchar(N) → varchar(M), integer → bigint, smallint → integer) are recognized as safe and don't trigger TABLE_REWRITE.
Renamed an index or foreign key? PgDesigner compares the structural definition (table, columns, method) — not just the name. If the structure is identical, it skips the drop+add cycle. Only actual structural changes trigger recreation.
Tables (including comment and PARTITION BY), columns (type, nullable, default, identity with sequence options, comment, compression, storage), indexes, FK, PK, UNIQUE, CHECK constraints, enum values (ADD VALUE), and partitions (CREATE, DETACH, re-ATTACH on bound change). Views and functions diff is planned for Phase 2.
pgdesigner diff old.pgd new.pgd
pgdesigner diff old.pgd new.pgd -o migration.sql Press Ctrl+D in the UI for a live diff preview with hazard badges — red for dangerous, yellow for warnings.