Skip to content

Re-seed after a schema migration

Problem: a migration changed the schema; you want the existing seed data updated, not rebuilt from scratch.

Solution:

Terminal window
# See exactly what changed vs the stored snapshot
dbsprout diff --file schema_v2.sql
# Apply only the diff-driven updates
dbsprout generate --incremental --file schema_v2.sql

Diff against a specific snapshot instead of the latest with --snapshot <hash-prefix>, and emit machine-readable output with dbsprout diff --format json.

Why it works: diff reports added/removed tables, column type and nullability changes, and FK/index changes. generate --incremental maps each change to a targeted update rule (new column → backfill, new table → generate, dropped table → skip) and leaves unaffected data untouched.