Bug? Expected functionality? No error thrown on rollback if migration doesn't exist
- Lingua principale
- Go
- Stelle
- 7.4k
- Fork
- 379
- Merge medio
- 6m
- PR unite (30g)
- 1
Descrizione
**Description**
When attempting to rollback a migration whose file is not present in the current codebase, dbmate silently skips the missing migration and rolls back the previous available migration instead of throwing an error.
We encountered this when a migration was accidentally run against our staging database from a local machine. The staging environment didn't have the migration file, but when we attempted to rollback (from the staging app), dbmate reported success while actually rolling back the wrong migration.
While this scenario represents user error and isn't a standard workflow, the silent failure behavior is problematic because it provides misleading feedback and can cause unintended schema changes.
Version: 2.26.0
Database: Postgres
Operating System: Heroku
**Steps To Reproduce**
1. Apply migration A to database
2. Apply migration B to database
3. Remove migration B file from codebase (simulating missing migration file)
4. Run dbmate rollback
5. dbmate reports "Done." and rolls back migration A instead of migration B
*Expected Behavior*
dbmate should throw an error when the most recent migration file cannot be found, such as:
Error: Cannot rollback migration [filename] - migration file not found
*Actual Behavior*
dbmate silently skips the missing migration file and rolls back the next available migration, reporting success while performing an unintended operation.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.