# Generated by Django 4.2.16 on 2024-11-08 13:36

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


def remove_unnecessary_mails(apps, schema_editor):
    ScheduledMail = apps.get_model("sendmail", "ScheduledMail")
    ScheduledMail.objects.filter(rule__subevent__isnull=False).exclude(subevent=F('rule__subevent')).delete()


class Migration(migrations.Migration):
    dependencies = [
        ("sendmail", "0007_bigint"),
    ]

    operations = [
        migrations.RunPython(remove_unnecessary_mails),
    ]
