Database Migration Planner

Database Migration Planner

1. Before/after schema

PostgreSQL 16 subset only. Paste CREATE TABLE and CREATE INDEX definitions; each statement needs a semicolon. All identifiers are simple unquoted names.

Review-only planner. It does not inspect live data, outside objects, migrations already applied, table locks or backups. Never run generated SQL without database review.

Examples

Use old_table -> new_table or old_table.old_column -> new_column. Column mappings use the old table name, even if that table is renamed.

Supported syntax and limits

CREATE TABLE t (id integer NOT NULL, name text, PRIMARY KEY (id), CONSTRAINT fk FOREIGN KEY (id) REFERENCES parent (id)); CREATE [UNIQUE] INDEX idx ON t (name); Types: integer, bigint, text, boolean, date, uuid, timestamp [with time zone], varchar(n), numeric(p[,s]). A referenced column needs a modeled single-column primary or unique key.

No quoted/schema-qualified names, defaults, serial/identity, CHECK, UNIQUE table constraints, composite foreign keys, ON DELETE actions, ALTER statements, views, triggers, partial/expression/concurrent indexes or arbitrary SQL. Unsupported input is rejected entirely.

At most 24,000 DDL characters per snapshot, 32 tables, 256 columns, 64 indexes and 64 foreign keys. This is a schema model, not a dump loader.

Comments & questions

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

  1. Paste the previous and desired CREATE TABLE/INDEX snapshots or open local SQL files.
  2. Use an example and map each intended rename with old -> new; treat unpaired names as intentional only after review.
  3. Analyze and inspect ordered objects, dependencies, high-risk drops and manual blockers.
  4. 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.

References

Related Tools

SQL FormatterER Diagram DesignerText DiffWasm Module InspectorHreflang Matrix CheckerAST Query PlaygroundContainer Build GraphDependency Graph ExplorerSemver Range LabCron Schedule AuditorPatch Review WorkbenchSource Map ExplorerLocalization Catalog AuditorStructured Data ReviewerHTTP Archive AnalyzerWebhook Signature LabProtobuf Schema WorkbenchGraphQL Schema LabAvro Schema EvolutionLocal SQL WorkbenchSchema Form BuilderMesh Repair WorkbenchPipe Network LabRobot Arm Kinematics LabThermal Network LabBeam Response LabGear Train DesignerTolerance Stackup LabSensor Calibration FitPCB Stackup PlannerDigital Filter DesignerNetwork Reachability MapSun Shadow MapGPS Error SimulatorDigital Logic SimulatorAnalog Circuit LabMechanism Linkage LabAnalysis Mesh GeneratorOpenAPI Contract InspectorDimensional Equation CheckerTruss Force LabBoolean Minimization LabControl Response LabQueueing Simulation LabGeofence Event SimulatorCoordinate Reference LabSurvey Traverse LabRaster Classification LabChoropleth Design LabMap Print ComposerRaster Reprojection LabElevation Contour MakerTerrain Viewshed LabWatershed DelineatorMap Tile PackagerText File Encoding WorkbenchFilesystem Portability AuditorSBOM License ExplorerFile Signature Auditornpm Lockfile Conflict ResolverSource Secret AuditorOffline Web Package BuilderCertificate Chain InspectorTorrent Metainfo InspectorChunked File PackagerEncrypted File VaultDuplicate File FinderArchive WorkbenchDesign Token ManagerSpacing Token DesignerResponsive Type SystemPackaging Dieline DesignerSVG Icon Sprite PackerFlex Layout PlaygroundCSS Grid PlaygroundRegex Equivalence LabMarkdown Repository AuditorLog Template MinerResponsive Layout AuditorEmail Template PreviewInternal Link GraphState Machine TesterPetri Net SimulatorGit History VisualizerCurl Request WorkbenchBinary Protocol DesignerHex File EditorBinary Patch WorkbenchFile Signature WorkbenchAPI Mock SandboxSchema Column MapperEvent Log SessionizerTime Series Gap AuditorStratified Data SplitterData Lineage DesignerDecision Tree LabData Anonymization WorkbenchData Expectation RunnerJSON Schema ValidatorBasket Pattern AnalyzerRobots Policy TesterSEO HTML AuditorAccessibility Structure AuditorSyndication Feed WorkbenchIndexNow Payload BuilderCrawl Log AnalyzerCSP Policy WorkbenchSearch Performance AnalyzerCSV Formula Risk AuditorCORS Response SimulatorCache Header LabCookie Policy InspectorWeb Vitals Trace LabSitemap Health AuditorBatch File RenamerFile Manifest VerifierFolder Space MapFolder Difference ReviewerRoute Order OptimizerGeoJSON Map EditorPolygon Overlay LabCartographic Label PlacerSpatial Table JoinGeoJSON Topology AuditorGPX Track AnalyzerTrack Privacy RedactorCSV Table JoinCSV Pivot WorkbenchScientific Data ProfilerTabular Cleaning WorkbenchRecord ReconciliationData Dictionary BuilderCanonical Graph AuditorRedirect Plan TesterHTTP response and ping reference testBrowser and System InformationJSON ↔ YAML ConverterXML ↔ JSON ConverterHTML FormatterJavaScript MinifierMock Data Generator.gitignore GeneratorLicense GeneratorUser-Agent ParserPassword Strength CheckerCode to ImageXML FormatterHTTP Status Code LookupMIME Type LookupJS & SQL String EscapeCSS Box Shadow GeneratorCSS Gradient GeneratorIndent ConverterNumber Base ConverterUnicode Escape ConverterUnicode InspectorJSON Structure DiffMarkdown Table GeneratorBase64 EncoderJSON FormatterURL EncoderCron Expression GeneratorRegex TesterUUID GeneratorHash GeneratorTimestamp ConverterJWT DecoderHTML Entity ConverterMarkdown PreviewCSS MinifierMeta Tag GeneratorJSON ↔ CSVCase ConverterImage to Base64
Explore all Dev Tools tools →Image/Media →Text/Convert →Life/Fun →