diff --git a/src/notifications/migrations/0002_deadlinereminderlog_deadline_re_ticket__850437_idx_and_more.py b/src/notifications/migrations/0002_deadlinereminderlog_deadline_re_ticket__850437_idx_and_more.py new file mode 100644 index 0000000..8085e08 --- /dev/null +++ b/src/notifications/migrations/0002_deadlinereminderlog_deadline_re_ticket__850437_idx_and_more.py @@ -0,0 +1,27 @@ +# Generated by Django 6.0.6 on 2026-06-28 10:14 + +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("notifications", "0001_initial"), + ("tickets", "0002_ticketcomment_ticket_comm_ticket__5ef05d_idx_and_more"), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.AddIndex( + model_name="deadlinereminderlog", + index=models.Index( + fields=["ticket", "user"], name="deadline_re_ticket__850437_idx" + ), + ), + migrations.AddIndex( + model_name="notification", + index=models.Index( + fields=["user", "created_at"], name="notificatio_user_id_7336fd_idx" + ), + ), + ] diff --git a/src/notifications/models.py b/src/notifications/models.py index 1eb940f..d185368 100644 --- a/src/notifications/models.py +++ b/src/notifications/models.py @@ -24,6 +24,7 @@ class Notification(models.Model): verbose_name_plural = "Notifications" indexes = [ models.Index(fields=["user", "read_at"]), + models.Index(fields=["user", "created_at"]), ] ordering = ("-created_at",) @@ -51,6 +52,9 @@ class DeadlineReminderLog(models.Model): db_table = "deadline_reminder_log" verbose_name = "Deadline Reminder Log" verbose_name_plural = "Deadline Reminder Logs" + indexes = [ + models.Index(fields=["ticket", "user"]), + ] constraints = [ models.UniqueConstraint( fields=["ticket", "user", "days_before"],