diff --git a/src/projects/models.py b/src/projects/models.py index 0e7e19d..a528f03 100644 --- a/src/projects/models.py +++ b/src/projects/models.py @@ -31,6 +31,8 @@ class Project(models.Model): indexes = [ models.Index(fields=["pinned_date"]), models.Index(fields=["start_date", "end_date"]), + models.Index(fields=["name"]), + models.Index(fields=["created_at"]), ] def pin(self): @@ -124,6 +126,10 @@ class AutomationRule(models.Model): verbose_name = "Automation Rule" verbose_name_plural = "Automation Rules" ordering = ["-created_at"] + indexes = [ + models.Index(fields=["project", "is_active", "trigger_event"]), + models.Index(fields=["created_at"]), + ] def __str__(self): return f"[{self.project.ticket_prefix}] {self.name}"