sendmail: Add missing cleanup migration (#6158)

This commit is contained in:
pajowu
2026-05-11 14:53:47 +02:00
committed by GitHub
parent 71edfa8e1a
commit 27148324a6
2 changed files with 42 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
# Generated by Django 5.2.13 on 2026-05-06 15:45
from django.db import migrations
from django.db.models import F
def remove_cross_event_scheduled_mails(apps, schema_editor):
Rule = apps.get_model("sendmail", "Rule")
ScheduledMail = apps.get_model("sendmail", "ScheduledMail")
ScheduledMail.objects.filter(subevent__isnull=False).exclude(subevent__event=F('rule__event')).delete()
Rule.objects.filter(subevent__isnull=False).exclude(subevent__event=F('event')).delete()
class Migration(migrations.Migration):
replaces = [('sendmail', '0011_remove_cross_event_scheduled_mails'), ('sendmail', '0012_remove_cross_event_scheduled_mails')]
dependencies = [
('sendmail', '0010_auto_20250801_1342'),
]
operations = [
migrations.RunPython(
code=remove_cross_event_scheduled_mails,
),
]

View File

@@ -0,0 +1,17 @@
from django.db import migrations
from django.db.models import F
def remove_cross_event_scheduled_mails(apps, schema_editor):
ScheduledMail = apps.get_model("sendmail", "ScheduledMail")
ScheduledMail.objects.filter(subevent__isnull=False).exclude(subevent__event=F('rule__event')).delete()
class Migration(migrations.Migration):
dependencies = [
("sendmail", "0011_remove_cross_event_scheduled_mails"),
]
operations = [
migrations.RunPython(remove_cross_event_scheduled_mails),
]