Migrate only skipped migrations whose number was already applied (n <= current). Point an older binary at a database a newer binary had already migrated and it started happily, then read columns that had moved. For a self-hosted app that is the worst failure mode: silent schema confusion rather than a clean refusal. Migrate now errors when PRAGMA user_version exceeds the highest embedded migration, naming both numbers. Both callers already propagate the error, so the binary exits at startup instead. Verified red-green: removing the guard fails TestMigrateRefusesDatabaseNewerThanBinary. |
||
|---|---|---|
| .. | ||
| config.go | ||
| config_test.go | ||
| db.go | ||
| logging.go | ||
| migrate.go | ||
| migrate_test.go | ||
| stamp.go | ||
| stamp_test.go | ||