-
Notifications
You must be signed in to change notification settings - Fork 381
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set
current_bed
to None
when discharging and custom migration for…
… past consultations. (#1401) * set current_bed = None when discharging * custom migration for existing consultations --------- Co-authored-by: Vignesh Hari <vichuhari100@gmail.com>
- Loading branch information
1 parent
5ac8ab1
commit 4260241
Showing
2 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 4.2.2 on 2023-06-21 13:27 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
def free_discharged_current_beds(apps, schema_editor): | ||
PatientConsultation = apps.get_model("facility", "PatientConsultation") | ||
|
||
PatientConsultation.objects.filter(discharge_date__isnull=False).exclude( | ||
current_bed=None | ||
).update(current_bed=None) | ||
|
||
dependencies = [ | ||
("facility", "0362_merge_20230617_1253"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
free_discharged_current_beds, reverse_code=migrations.RunPython.noop | ||
) | ||
] |