Schema Diff

The schema diff tool compares two ER diagram versions — old and new — and produces a structured list of changes. Use it to review schema evolution between diagram versions, catch destructive changes before deployment, or generate a checklist for a migration script.

How to Use

  1. Go to the Diff page.
  2. Paste your old diagram in the left panel and your new diagram in the right panel.
  3. Select the diagram type for each (Mermaid or PlantUML). You can diff across formats.
  4. Click Compare to see the change list.

Change Operations

OpDescriptionDestructive?
CREATE_TABLENew table addedNo
DROP_TABLETable removedYes
ADD_COLUMNColumn added to existing tableNo
DROP_COLUMNColumn removed from existing tableYes
ALTER_COLUMNColumn type or nullability changedYes
ADD_FKForeign key relationship addedNo
DROP_FKForeign key relationship removedNo

Response Format

The diff result contains a summary and a changes array.

Old diagram
erDiagram
    USER {
        int id PK
        string name
        string email
    }
New diagram
erDiagram
    USER {
        int id PK
        string name
        string phone
    }
    PRODUCT {
        int id PK
        string sku UK
    }
JSON response
{
  "changes": [
    {
      "op": "DROP_COLUMN",
      "table": "USER",
      "column": "email",
      "destructive": true,
      "description": "Drop column email from table USER"
    },
    {
      "op": "ADD_COLUMN",
      "table": "USER",
      "column": "phone",
      "destructive": false,
      "description": "Add column phone to table USER"
    },
    {
      "op": "CREATE_TABLE",
      "table": "PRODUCT",
      "destructive": false,
      "description": "Create table PRODUCT"
    }
  ],
  "summary": {
    "total": 3,
    "additions": 2,
    "deletions": 1,
    "modifications": 0,
    "destructiveCount": 1
  }
}

Destructive Changes

Any change that would cause data loss in a live database is flagged as destructive:

  • DROP_TABLE — all data in the table is lost
  • DROP_COLUMN — all data in the column is lost
  • ALTER_COLUMN — type change may lose data or require a conversion

The web UI highlights destructive changes in red. The summary.destructiveCount field in the API response lets you fail CI builds that contain destructive changes.

Cross-Format Diff

You can compare a Mermaid diagram against a PlantUML diagram. Both parsers produce the same intermediate Schema model, so the diff is format-agnostic.

API Endpoint

See the API Reference for the full POST /v1/diff spec.