-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
feat(backup): Enable shimming deleted fields #66248
Conversation
We need to support deleted fields on Django model schemas for a number of self-hosted released (currently 2). This means that even if we delete a field on HEAD, we still need to make the import script aware that the field could exit on imported JSON, and pre-process that JSON in such a way that the field is removed in cases where the JSON was generated by an old version that still contained the field. There is no purpose in testing this code standalone. It passes tests in #65923, which is the first actual use of this shimming mechanism.
d829ac9
to
40cc7a0
Compare
src/sentry/backup/imports.py
Outdated
# around even if the dict is empty, to ensure that there is a ready place to pop shims into. For | ||
# each entry in this dict, please leave a TODO comment pointed to a github issue for removing | ||
# the shim, noting in the comment which self-hosted release will trigger the removal. | ||
deleted_fields: dict[str, set[str]] = {} |
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.
Is deleted_fields
being updated over time to store all the deleted fields? If so, would it be better to place this as a global variable at the top of the file or somewhere more clear?
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.
Done.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #66248 +/- ##
=======================================
Coverage 84.27% 84.27%
=======================================
Files 5304 5304
Lines 237049 237058 +9
Branches 41024 41030 +6
=======================================
+ Hits 199768 199779 +11
+ Misses 37062 37060 -2
Partials 219 219
|
We need to support deleted fields on Django model schemas for a number of self-hosted released (currently 2). This means that even if we delete a field on HEAD, we still need to make the import script aware that the field could exit on imported JSON, and pre-process that JSON in such a way that the field is removed in cases where the JSON was generated by an old version that still contained the field. There is no purpose in testing this code standalone. It passes tests in #65923, which is the first actual use of this shimming mechanism.
We need to support deleted fields on Django model schemas for a number of self-hosted released (currently 2). This means that even if we delete a field on HEAD, we still need to make the import script aware that the field could exit on imported JSON, and pre-process that JSON in such a way that the field is removed in cases where the JSON was generated by an old version that still contained the field.
There is no purpose in testing this code standalone. It passes tests in #65923, which is the first actual use of this shimming mechanism.