Database Migration Planner
Compare two small PostgreSQL 16 schema snapshots instead of comparing SQL characters. A strict, local parser models tables, columns, one-column named foreign keys, primary keys and simple indexes. It orders dependency removal, renames, additions and final constraints. Unpaired old/new names are ambiguous until you map them as a rename or explicitly confirm replacement. Destructive and validation-sensitive steps require individual review; unsupported changes block SQL export. This planner never connects to a database or knows its rows, views, permissions or deployment locks.
Key features
- Strict PostgreSQL 16 DDL subset and whole-input errors instead of silent partial parsing
- Explicit table and column renames; unpaired names stay ambiguous
- Ordered table, column, index and foreign-key changes with dependency notes
- High-risk acknowledgment and manual blockers before SQL export
- Local JSON review report and gated PostgreSQL SQL download
How to use
- Paste the previous and desired CREATE TABLE/INDEX snapshots or open local SQL files.
- Use an example and map each intended rename with old -> new; treat unpaired names as intentional only after review.
- Analyze and inspect ordered objects, dependencies, high-risk drops and manual blockers.
- Acknowledge each high-risk step to unlock review SQL; check it against a backup and real database before using it.
Use cases
- Plan an explicit column rename without silently deleting its values
- Check that an old foreign key is removed before a referenced table is dropped
- See a unique index or new foreign key as a data-dependent validation risk
- Flag a type change or new required column for manual backfill planning
Frequently asked questions
Which SQL dialect and statements work?
Only a bounded PostgreSQL 16 subset: unquoted lowercase-style identifiers, CREATE TABLE with supported primitive column types and optional NOT NULL, table-level PRIMARY KEY, named single-column FOREIGN KEY, and simple CREATE [UNIQUE] INDEX. Other syntax fails closed.
Does the planner infer a rename?
No. A removed name and a new name might be a rename or two separate operations. Supply an explicit table/column mapping; otherwise confirm intentional replacement before SQL export. Individual destructive steps also need acknowledgment.
Will the SQL safely migrate production data?
No automatic execution occurs. The script has BEGIN/COMMIT and RESTRICT, but live rows, outside views/functions, locks, permissions, backfills and rollback plans are unknown. Test with a backup and review with a database operator.
Why is type change or a new NOT NULL column blocked?
PostgreSQL may require a USING expression or a backfill and may reject existing rows. This tool does not invent data conversions or defaults.
Do existing foreign keys and indexes affect ordering?
Modeled obsolete foreign keys and indexes are removed first; new tables are created without foreign keys, and new constraints are added last. Unmodeled external dependencies can still block RESTRICT.
Privacy
DDL and rename text are parsed in this browser only. The tool does not connect to a database or submit schemas to an application API; downloads are local.
Comments & questions