Skip to content

Commit

Permalink
check if event type exists before running migration
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad committed Aug 14, 2024
1 parent 9020dea commit 6bc7099
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ def forward_rename_dailyround_events(apps, schema_editor):
"facility", "PatientConsultationEvent"
)

event_type_id = EventType.objects.get(name="RESPIRATORY_SUPPORT").id
event_type = EventType.objects.filter(name="RESPIRATORY_SUPPORT")
if not event_type.exists():
return
event_type_id = event_type.first().id

paginator = Paginator(
PatientConsultationEvent.objects.filter(
object_model="DailyRound",
Expand All @@ -36,7 +40,11 @@ def reverse_rename_dailyround_events(apps, schema_editor):
"facility", "PatientConsultationEvent"
)

event_type_id = EventType.objects.get(name="RESPIRATORY_SUPPORT").id
event_type = EventType.objects.filter(name="RESPIRATORY_SUPPORT")
if not event_type.exists():
return
event_type_id = event_type.first().id

paginator = Paginator(
PatientConsultationEvent.objects.filter(
object_model="DailyRound",
Expand Down

0 comments on commit 6bc7099

Please sign in to comment.