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
Section titled “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 snapshotdbsprout diff --db postgresql://localhost/myapp
# Compare a schema file insteaddbsprout diff --file schema_v2.sql
# Diff against a specific snapshot, as JSON (for CI)dbsprout diff --snapshot a1b2c3d4 --format jsonDetected changes include added/removed tables, added/removed/retyped columns, nullability and default changes, and added/removed foreign keys and indexes.
Incremental Generation
Section titled “Incremental Generation”Instead of regenerating every table, apply only the diff-driven changes to the existing seed data:
# Update against the latest snapshotdbsprout generate --incremental
# Update against a new schema file or a specific snapshotdbsprout generate --incremental --file schema_v2.sqldbsprout generate --incremental --snapshot a1b2c3d4Each 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
Section titled “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.