Skip to content

Commit

Permalink
fix reverse migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
sainak committed Jan 21, 2025
1 parent e5ecbfc commit 33309da
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion care/facility/migrations/0478_migrate_organizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def migrate_organizations(apps, schema_editor):

def reverse_migrate_organizations(apps, schema_editor):
logger.debug("Reversing Migration Organization")
schema_editor.execute("DELETE FROM emr_organization WHERE meta->>'migration_id' = %s", [MIGRARION_ID])
schema_editor.execute("DELETE FROM emr_organization WHERE meta->>'migration_id' = %s", [str(MIGRARION_ID)])


class Migration(migrations.Migration):
Expand Down
2 changes: 1 addition & 1 deletion care/facility/migrations/0481_migrate_patient_reg.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def migrate_patient_registrations(apps, schema_editor):
def reverse_migrate_patient_registrations(apps, schema_editor):
PatientRegistration = apps.get_model("facility", "PatientRegistration")
PatientRegistration.objects.update(migrated_emr_patient_id=None)
schema_editor.execute("DELETE FROM emr_patient WHERE meta->>'migration_id' = %s", [MIGRARION_ID])
schema_editor.execute("DELETE FROM emr_patient WHERE meta->>'migration_id' = %s", [str(MIGRARION_ID)])



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ def migrate_consultations(apps, schema_editor):


def reverse_migrate_consultations(apps, schema_editor):
pass
PatientConsultation = apps.get_model("facility", "PatientConsultation")
PatientConsultation.objects.update(migrated_emr_encounter_id=None)
schema_editor.execute("DELETE FROM emr_encounter WHERE meta->>'migration_id' = %s", [str(MIGRARION_ID)])


class Migration(migrations.Migration):
Expand Down

0 comments on commit 33309da

Please sign in to comment.