Engineering posts
Snapshotting a migrated database instead of running migrations per test
- Category: Engineering post
- Status: confirmed
- Sources: gaultier.github.io
- Summary: The post describes speeding up a test suite by capturing a pristine, fully migrated database file once, then copying that golden database into each test rather than re-applying SQL migrations serially at the start of every test. The author reports a 7x speedup in a Go test suite, since most tests need only the latest schema and gain nothing from replaying migrations.
- Why it matters: Repeated migration runs are a common, often unnoticed tax on test-suite wall-clock time, and snapshotting is a portable fix.