Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix assigned_facility_type migration #1972

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions care/facility/migrations/0420_migrate_shifting_facility_type.py
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),
]
Loading