From 1aade0ff5c5991033ae1a8fc5cbf31a111560faa Mon Sep 17 00:00:00 2001 From: Francesco Filicetti Date: Tue, 17 Oct 2023 08:56:58 +0200 Subject: [PATCH] fix: db indexes --- ...et_uni_ticket__code_3920e0_idx_and_more.py | 28 +++++++++++++++++++ uniticket/uni_ticket/models.py | 5 ++++ 2 files changed, 33 insertions(+) create mode 100644 uniticket/uni_ticket/migrations/0014_ticket_uni_ticket__code_3920e0_idx_and_more.py diff --git a/uniticket/uni_ticket/migrations/0014_ticket_uni_ticket__code_3920e0_idx_and_more.py b/uniticket/uni_ticket/migrations/0014_ticket_uni_ticket__code_3920e0_idx_and_more.py new file mode 100644 index 00000000..0db1e4d8 --- /dev/null +++ b/uniticket/uni_ticket/migrations/0014_ticket_uni_ticket__code_3920e0_idx_and_more.py @@ -0,0 +1,28 @@ +# Generated by Django 4.2.5 on 2023-10-17 06:56 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("uni_ticket", "0013_ticketassignment_uni_ticket__office__f42ab9_idx"), + ] + + operations = [ + migrations.AddIndex( + model_name="ticket", + index=models.Index(fields=["code"], name="uni_ticket__code_3920e0_idx"), + ), + migrations.AddIndex( + model_name="ticket", + index=models.Index( + fields=["is_closed"], name="uni_ticket__is_clos_8d6d43_idx" + ), + ), + migrations.AddIndex( + model_name="ticket", + index=models.Index( + fields=["assigned_date"], name="uni_ticket__assigne_b1e790_idx" + ), + ), + ] diff --git a/uniticket/uni_ticket/models.py b/uniticket/uni_ticket/models.py index 57ebd6b9..b1d78441 100644 --- a/uniticket/uni_ticket/models.py +++ b/uniticket/uni_ticket/models.py @@ -632,6 +632,11 @@ class Meta: ] verbose_name = _("Ticket") verbose_name_plural = _("Ticket") + indexes = [ + models.Index(fields=['code',]), + models.Index(fields=['is_closed',]), + models.Index(fields=['assigned_date',]), + ] @property def taken_date(self):