# Generated by Django 5.1.7 on 2025-11-04 12:50

import django.db.models.deletion

from django.db import migrations, models


def update_notifications_done(apps, schema_editor):
    from django_project_base.notifications.models import DjangoProjectBaseNotification

    apps.get_model("notifications", "DjangoProjectBaseNotification").objects.exclude(
        delayed_to=DjangoProjectBaseNotification.DELAYED_INDEFINITELY
    ).update(done=True)


class Migration(migrations.Migration):
    dependencies = [
        ("notifications", "0011_djangoprojectbasemessageattachment"),
    ]

    operations = [
        migrations.AddField(
            model_name="djangoprojectbasenotification",
            name="done",
            field=models.BooleanField(default=False),
        ),
        migrations.AlterField(
            model_name="djangoprojectbasemessageattachment",
            name="message",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="attachments",
                to="notifications.djangoprojectbasemessage",
                verbose_name="Message",
            ),
        ),
        migrations.AddIndex(
            model_name="djangoprojectbasenotification",
            index=models.Index(fields=["delayed_to", "done"], name="notificatio_delayed_28febf_idx"),
        ),
        migrations.RunPython(update_notifications_done),
    ]
