-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix assigned_facility_type migration (#1972)
add missing migrate shifting assigned_facility_type
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
care/facility/migrations/0420_migrate_shifting_facility_type.py
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,32 @@ | ||
# Generated by Django 4.2.10 on 2024-03-14 10:18 | ||
|
||
from django.db import migrations | ||
|
||
|
||
def update_facility_types(apps, schema_editor): | ||
Facility = apps.get_model("facility", "ShiftingRequest") | ||
facilities_to_update = { | ||
801: 800, # 24x7 Public Health Centres to Primary Health Centres | ||
820: 800, # Urban Primary Health Center to Primary Health Centres | ||
831: 830, # Taluk Headquarters Hospitals to Taluk Hospitals | ||
850: 860, # General hospitals to District Hospitals | ||
900: 910, # Co-operative hospitals to Autonomous healthcare facility | ||
950: 870, # Corona Testing Labs to Govt. Labs | ||
1000: 3, # Corona Care Centre to Other | ||
8: 870, # Govt Hospital to Govt Medical College Hospitals | ||
} | ||
|
||
for old_id, new_id in facilities_to_update.items(): | ||
Facility.objects.filter(assigned_facility_type=old_id).update( | ||
assigned_facility_type=new_id | ||
) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("facility", "0419_alter_patientconsultation_patient_no"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(update_facility_types, migrations.RunPython.noop), | ||
] |