python-social-auth / social-app-django

Python Social Auth - Application - Django
BSD 3-Clause "New" or "Revised" License
1.97k stars 372 forks source link

fix: make migration 0013 reversible #533

Closed browniebroke closed 5 months ago

browniebroke commented 6 months ago

Proposed changes

As mentioned #495, the migration isn't reversible. ~I don't think we want to change anything in the backwards operation, so we might be enough to use RunPython.noop.~

Write a function to set the old fields from the _new JSON fields.

Types of changes

Please check the type of change your PR introduces:

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

Other information

Any other information that is important to this PR such as screenshots of how the component looks before and after the change.

codecov[bot] commented 6 months ago

Codecov Report

Attention: 24 lines in your changes are missing coverage. Please review.

Comparison is base (e90019f) 93.63% compared to head (cc31ccc) 91.72%.

Files Patch % Lines
...ocial_django/migrations/0013_migrate_extra_data.py 7.69% 24 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #533 +/- ## ========================================== - Coverage 93.63% 91.72% -1.92% ========================================== Files 39 39 Lines 1147 1172 +25 Branches 138 144 +6 ========================================== + Hits 1074 1075 +1 - Misses 48 72 +24 Partials 25 25 ``` | [Flag](https://app.codecov.io/gh/python-social-auth/social-app-django/pull/533/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-social-auth) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/python-social-auth/social-app-django/pull/533/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-social-auth) | `91.72% <7.69%> (-1.92%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-social-auth#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

nijel commented 6 months ago

How is noop better here than failing? It just hides the fact that the data are not migrated during the reverse migration, what could lead to data loss.

browniebroke commented 6 months ago

What kind of data loss are we talking about?

browniebroke commented 6 months ago

Ah I see, we have the data being moved over from an old field to a new field. I get the problem you're raising now.

nijel commented 5 months ago

Merged, thanks for your contribution!