Skip to content

Commit

Permalink
migrate non null mcode fields only
Browse files Browse the repository at this point in the history
  • Loading branch information
v-rocheleau committed Oct 24, 2023
1 parent 76ba2cc commit 2be85b0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion chord_metadata_service/patients/migrations/0005_v5_0_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ def migrate_mcode_fields(apps, _schema_editor):
Individual = apps.get_model("patients", "Individual")
for ind in Individual.objects.all():
for field in MCODE_FIELDS:
ind.extra_properties[field] = getattr(ind, field)
if field_value := getattr(ind, field):
ind.extra_properties[field] = field_value

ind.save()


Expand Down

0 comments on commit 2be85b0

Please sign in to comment.