-
Notifications
You must be signed in to change notification settings - Fork 15
Fix fields incorrectly marked as autocreated in squashed migration #1506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
324d350
to
925eeb7
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1506 +/- ##
=======================================
Coverage 79.46% 79.46%
=======================================
Files 121 121
Lines 5409 5409
=======================================
Hits 4298 4298
Misses 1111 1111 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a test-project, verbose_name='ID' is a side-effect of autocreated=True.
I think the smart thing to do is to manually add verbose_name=ID to the manually set primary key fields. I doubt anything is using this (besides admin) but it is nice to be consistent.
Yeah I didn't test this but thought this was the case since that was generated in the initial migration and then seemed to be undone when they were converted to bigautofield and no longer autocreated. I wasn't really sure what its for but it was also triggering changes and seemed to result from auto creation so removed it. Adding verbose_name to the model makes sense will do that. |
|
Merged manually. |
Scope and purpose
Since the incident migrations were squashed in 7cbcc9f it seems like makemigrations still detects some small changes in some BigAutoField's without making any changes to the database model. The reason for these changes seem to be that in the squashed migration these fields are marked as auto_created even though they are explicitly defined in the model. Removing auto_created and vebose_name from these fields makes makemigrations no longer detect changes. This also aligns with how these fields were defined in the latest migration before squashing where these fields were converted to BigAutoField (10bc007#diff-0f8dba41fb179ac51f795d2f691e8ec017ba2eb706190a6bc3ad5b7b8904f34f)
Generated migration with no model changes
Related to discussion in #1504
This pull request
Contributor Checklist
Every pull request should have this checklist filled out, no matter how small it is.
More information about contributing to Argus can be found in the
Development docs.
Updated the ER diagramThere are no changes to the ER diagram