A database migration may look like an ordinary SQL file. During early development, it is tempting to edit 0001_initial.sql , drop a local database, and start again.
That workflow stops being harmless once the application ships.
A user's database is not your disposable development database. SQLx records applied migration versions and checksums in _sqlx_migrations . Changing an already-applied migration changes the history the new binary claims to understand.
1. A shipped migration is immutable history
Imagine version 1.0 ships 0001_spaces.sql . A user installs it, and SQLx records the migration version and checksum.
Later, a developer edits the same file. The filename and version are unchanged, but the contents—and checksum—are different. When the newer binary compares its migration files with the database history, SQLx detects the mismatch and refuses to proceed.
That is a safety mechanism.…