# Generated by Django 4.0.5 on 2022-06-28 09:39

from django.db import migrations, models
from django.db.migrations import RunPython
from django.db.models import F


def func(apps, schema_editor):
    model_cls = apps.get_model("meta_subject", "studymedication")
    model_cls.objects.filter(refill_date__isnull=True).update(refill_date=F("report_datetime"))
    model_cls = apps.get_model("meta_subject", "historicalstudymedication")
    model_cls.objects.filter(refill_date__isnull=True).update(refill_date=F("report_datetime"))


class Migration(migrations.Migration):

    dependencies = [
        ("meta_subject", "0107_auto_20220415_0043"),
    ]

    operations = [RunPython(func)]
