Migrations & Incremental Seeding
When your schema evolves, DBSprout can report exactly what changed and apply only the necessary updates to existing seed data.
Report Schema Drift
dbsprout diff compares the current schema against the stored snapshot and
prints a human-readable change report:
# Compare a live database against the latest snapshot
dbsprout diff --db postgresql://localhost/myapp
# Compare a schema file instead
dbsprout diff --file schema_v2.sql
# Diff against a specific snapshot, as JSON (for CI)
dbsprout diff --snapshot a1b2c3d4 --format json
Detected changes include added/removed tables, added/removed/retyped columns, nullability and default changes, and added/removed foreign keys and indexes.
Incremental Generation
Instead of regenerating every table, apply only the diff-driven changes to the existing seed data:
# Update against the latest snapshot
dbsprout generate --incremental
# Update against a new schema file or a specific snapshot
dbsprout generate --incremental --file schema_v2.sql
dbsprout generate --incremental --snapshot a1b2c3d4
Each change type maps to a targeted update rule (new column → backfill, new table → generate, dropped table → skip, …) so unaffected data is preserved.
Migration File Parsers
DBSprout understands common migration formats, so a schema can be derived from a migration history rather than a live database:
| Framework | Format |
|---|---|
| Alembic | Python migration scripts |
| Django | migrations/ operations |
| Flyway | Versioned SQL migrations |
| Liquibase | XML changelogs |
| Prisma | migration.sql files |
Point --file at a migration source the same way you would a DDL file.