diff --git a/uniticket/uni_ticket/migrations/0022_ticket_uni_ticket__priorit_0066dd_idx_and_more.py b/uniticket/uni_ticket/migrations/0022_ticket_uni_ticket__priorit_0066dd_idx_and_more.py new file mode 100644 index 00000000..9887e4c8 --- /dev/null +++ b/uniticket/uni_ticket/migrations/0022_ticket_uni_ticket__priorit_0066dd_idx_and_more.py @@ -0,0 +1,25 @@ +# Generated by Django 4.2.16 on 2024-11-11 14:45 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('uni_ticket', '0021_alter_task_options_alter_ticketcategorytask_options_and_more'), + ] + + operations = [ + migrations.AddIndex( + model_name='ticket', + index=models.Index(fields=['priority', 'created'], name='uni_ticket__priorit_0066dd_idx'), + ), + migrations.AddIndex( + model_name='ticketassignment', + index=models.Index(fields=['ticket_id', 'follow'], name='uni_ticket__ticket__9822c1_idx'), + ), + migrations.AddIndex( + model_name='ticketassignment', + index=models.Index(fields=['taken_date'], name='uni_ticket__taken_d_7d4fc6_idx'), + ), + ] diff --git a/uniticket/uni_ticket/models.py b/uniticket/uni_ticket/models.py index 32558667..4efa7b16 100644 --- a/uniticket/uni_ticket/models.py +++ b/uniticket/uni_ticket/models.py @@ -501,6 +501,7 @@ class Meta: "-created", "code", ] + indexes = [models.Index(fields=["priority", "created"])] verbose_name = _("Ticket") verbose_name_plural = _("Ticket") @@ -1186,7 +1187,10 @@ class TicketAssignment(TimeStampedModel): class Meta: unique_together = ("ticket", "office") ordering = ["created"] - indexes = [models.Index(fields=["office_id", "follow"])] + indexes = [models.Index(fields=["office_id", "follow"]), + models.Index(fields=["ticket_id", "follow"]), + models.Index(fields=["taken_date"]), + ] verbose_name = _("Competenza Ticket") verbose_name_plural = _("Competenza Ticket")