Schema Diff

Paste two ER diagram versions to see what changed β€” added tables, dropped columns, and destructive operations highlighted instantly.

What is Schema Diff?

The Schema Diff tool compares two ER diagram versions β€” an old and a new β€” and produces a structured list of changes. Use it to review schema evolution, catch destructive changes (dropped tables, dropped columns, type changes) before they reach production, or generate a migration checklist.

Diagram2Code supports cross-format diffing: you can compare a Mermaid diagram against a PlantUML diagram. Both are parsed into the same intermediate schema model before comparison.

Why use a Schema Diff tool?

As your data model evolves, keeping track of what changed between diagram versions is critical β€” especially when those changes translate directly into database migrations. The Schema Diff tool makes this process explicit and visual:

  • Catch destructive operations early β€” Dropping a table or column in production can cause irreversible data loss. The diff flags these as destructive so you can review them before running a migration.
  • Generate migration checklists β€” The structured change list (CREATE TABLE, ADD COLUMN, DROP FK, etc.) maps directly to the SQL migration statements you need to write or generate.
  • Code review for schema changes β€” Include a diff output in your pull request description so reviewers can see the data model impact without reading raw SQL.
  • Cross-format comparison β€” Mix Mermaid and PlantUML diagrams freely. Both are normalized into the same intermediate schema representation before comparison.

Supported change types

  • CREATE TABLE / DROP TABLE β€” A new entity was added or an existing entity was removed from the schema.
  • ADD COLUMN / DROP COLUMN β€” A column was introduced or removed within an existing table. DROP COLUMN is flagged as destructive.
  • ALTER COLUMN β€” A column's type, nullability, or default value changed. May be destructive depending on the change.
  • ADD FK / DROP FK β€” A foreign key relationship was added or removed between tables.

How to use the Schema Diff tool

Paste your old (base) ER diagram into the left panel and your new (target) diagram into the right panel. Select the diagram format for each β€” Mermaid or PlantUML β€” then click Compare. The diff engine parses both diagrams, normalizes them, and produces a colour-coded list of changes. Destructive operations are highlighted in red. You can also trigger a comparison with Ctrl+Enter (or ⌘+Enter on macOS).

Integration with the converter

The Schema Diff tool works hand-in-hand with the diagram to code converter. A common workflow is: design your ER diagram, generate SQL with the converter, update the diagram to reflect a new requirement, diff the two versions to see what changed, then write a targeted migration script for only those changes. This keeps your database schema in sync with your diagram at every stage of development.