Skip to content

Commit

Permalink
Convert ABDM into Plug - Part 2/3 (#2313)
Browse files Browse the repository at this point in the history
Convert ABDM into Plug - Part 2/3 (#2313)

---------

Co-authored-by: Aakash Singh <mail@singhaakash.dev>
Co-authored-by: Khavin Shankar <khavinshankar@Khavins-MacBook-Air.local>
  • Loading branch information
3 people authored Oct 18, 2024
1 parent 14d3ef9 commit 0677656
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 13 deletions.
30 changes: 30 additions & 0 deletions care/abdm/migrations/0014_replace_0013.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Generated by Django 4.2.10 on 2024-04-21 17:40

# This is a replacement migration for abdm.0013 that omits the RunPython operation (reverse_patient_abhanumber_relation) and facility migration dependency.

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("abdm", "0012_consentrequest_status"),
]

replaces = [
("abdm", "0013_abhanumber_patient"),
]

operations = [
migrations.AddField(
model_name="abhanumber",
name="patient",
field=models.OneToOneField(
blank=True,
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="abha_number",
to="facility.patientregistration",
),
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ def reverse_patient_abhanumber_relation(apps, schema_editor):
AbhaNumber = apps.get_model("abdm", "AbhaNumber")

patients = (
Patient.objects.annotate(removed_field=RawSQL("abha_number_id", ()))
.filter(abha_number__isnull=False)
.select_related("abha_number")
Patient.objects.filter(abha_number__isnull=False)
)
abha_numbers_to_update = []

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class Migration(migrations.Migration):
dependencies = [
("abdm", "0001_initial_squashed_0007_alter_abhanumber_id"),
# ("abdm", "0001_initial_squashed_0007_alter_abhanumber_id"),
("facility", "0373_remove_patientconsultation_hba1c"),
]

Expand All @@ -22,23 +22,17 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name="historicalpatientregistration",
name="abha_number",
field=models.ForeignKey(
field=models.IntegerField(
blank=True,
db_constraint=False,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="+",
to="abdm.abhanumber",
),
),
migrations.AddField(
model_name="patientregistration",
name="abha_number",
field=models.OneToOneField(
field=models.IntegerField(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="abdm.abhanumber",
),
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class Migration(migrations.Migration):
dependencies = [
("facility", "0453_merge_20240824_2040"),
("abdm", "0013_abhanumber_patient"),
# ("abdm", "0013_abhanumber_patient"),
]

operations = [
Expand Down

0 comments on commit 0677656

Please sign in to comment.