# 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
