rust
database_error
ai_generated
true
error returned from database: migration checksum mismatch for migration
ID: rust/rust-sqlx-migration-error
83%Fix Rate
85%Confidence
50Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 1 | active | — | — | — |
Root Cause
An already-applied migration was modified. SQLx stores checksums to ensure migration integrity.
genericWorkarounds
-
90% success Create a new migration with the corrective changes instead of modifying the existing one
sqlx migrate add fix_previous_migration # Write ALTER TABLE or corrective SQL in the new migration
Sources: https://docs.rs/sqlx/latest/sqlx/migrate/index.html
-
88% success For development only: drop and recreate the database
sqlx database drop sqlx database create sqlx migrate run
Sources: https://docs.rs/sqlx/latest/sqlx/migrate/index.html
Dead Ends
Common approaches that don't work:
-
Delete the _sqlx_migrations table to re-run all migrations
75% fail
Re-running CREATE TABLE migrations on existing tables causes SQL errors; data may be lost
Error Chain
Preceded by:
Frequently confused with: