# Generated by Django 4.2.15 on 2025-08-01 13:42

from django.db import migrations


def migrate_pending_overdue(apps, schema_editor):
    Rule = apps.get_model("sendmail", "Rule")
    for r in Rule.objects.filter(restrict_to_status__icontains="p__overdue"):
        rts = r.restrict_to_status
        rts.remove('p__overdue')
        rts.append('n__pending_overdue')
        r.restrict_to_status = rts

        r.save(update_fields=["restrict_to_status"])


class Migration(migrations.Migration):

    dependencies = [
        ("sendmail", "0009_auto_20241113_1343"),
    ]

    operations = [
        migrations.RunPython(
            migrate_pending_overdue,
            migrations.RunPython.noop,
        )
    ]