fix: warn and exit 1 when --since matches no migrations, note skipped graph checks#52
Merged
Merged
Conversation
Previously, mrt fix silently returned 'No fix needed' for Django migrations containing AddField NOT NULL, AlterField, RenameField, or RenameModel — even though mrt check would flag those as warnings. This was misleading. Now mrt fix detects these unsupported operations and exits 1 with a clear message explaining which operations were found and that they require manual intervention. Null-safe AddField and operations with defaults are correctly still treated as 'no fix needed'. Fixes #37
… graph checks Two issues addressed: - #36: --since with an unknown or unanchored revision previously returned 'No rollback risks detected' (exit 0), giving a false sense of safety. Now exits 1 with a clear warning: '--since <rev> matched no migrations'. - #34: when --since is valid, print the count of migrations being checked and a note that graph checks (orphan, data-hole) are skipped so users know to run a full check separately. Fixes #36, fixes #34
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problems
Two related issues with
mrt check --since:#36: Passing an unknown or unanchored revision silently returned "No rollback risks detected" (exit 0). Users could mistake this for a clean result when the filter simply matched nothing.
#34: When
--sinceis valid, graph-level checks (orphan detection, data-hole analysis) are already skipped — but there was no indication of this. Users had no way to know they needed a separate full-history run.Fix
--since <rev>resolves to an empty set, exit 1 immediately with:--since <rev>is valid, print the migration count and a note:Tests
Added three tests covering:
Fixes #36, fixes #34