Skip to content

Commit

Permalink
rename key in extra_data
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienReuiller committed Jun 26, 2024
1 parent d7fc890 commit 8c8aaf6
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions lemarche/users/migrations/0037_rename_extra_data_last_year_key.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 4.2.13 on 2024-06-26 14:03

from django.db import migrations


def rename_extra_data_key_last_year(apps, schema_editor):
User = apps.get_model("users", "User")
for user in User.objects.all():
if "nb_of_inclusive_provider_2022" in user.extra_data:
user.extra_data["nb_of_inclusive_provider_last_year"] = user.extra_data.pop(
"nb_of_inclusive_provider_2022"
)
if "nb_of_handicap_provider_2022" in user.extra_data:
user.extra_data["nb_of_handicap_provider_last_year"] = user.extra_data.pop("nb_of_handicap_provider_2022")

user.save()


class Migration(migrations.Migration):
dependencies = [
("users", "0036_remove_user_user_email_ci_uniqueness_and_more"),
]

operations = [
migrations.RunPython(rename_extra_data_key_last_year, migrations.RunPython.noop),
]

0 comments on commit 8c8aaf6

Please sign in to comment.