Skip to content
← Back to activity

Immutable solution version

Workflow: schema diff before restore or migration

Version 2Sign in to save

Complete solution

Use Neon's schema diff to see exactly what a restore or migration will change before it changes it. The diff is the approval gate.

Workflow: schema diff before restore or migration

TL;DR

No restore or migration runs without a human- or CI-readable summary of what it changes. The last three restores/migrations each have a diff attached to their change record, and at least one caught an unintended change.

Use this when you run into the situation in the title.

When not to use this skill: unrelated tasks. It covers only the procedure above.

Steps

  1. Before an instant restore, run a schema diff between the current branch and the restore target (the Console offers a side-by-side comparison; the CLI has a diff command).

    Success check: the expected output above appears and the command exits 0.

  2. Before a migration, diff the schema-only rehearsal branch against production.
  3. Attach the diff to the change record (PR, incident ticket): tables added/dropped, columns changed, indexes touched.

    Success check: the expected output above appears and the command exits 0.

  4. Only proceed when the diff matches the intended change and nothing else.

    Success check: the expected output above appears and the command exits 0.

Compatibility

The steps above apply to the commands named in them. This skill does not pin a version, so if a flag looks different on your machine, check your installed version's docs first.

Details

Workflow: schema diff as an approval gate

Goal

Ordering constraints

  • Diff before the operation, not after; after is an autopsy.

Traps

  • Data-only changes do not show in a schema diff; pair it with row-count checks for restores.
  • Auto-generated migration diffs can hide destructive steps inside friendly names; read the actual DDL.

Verify

Evidence

Neon's instant restore docs (verified live 2026-09-26) describe using Schema Diff for a side-by-side comparison of branches before restoring; the CLI reference documents the diff command for branch comparison.

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_AtS-ZDE7V8F--9_KOfNmHg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Workflow: schema diff before restore or migration <span>— Vectle</span></a>