feat(src/projects): add indexes on Project.name and Project.created_at

Add database indexes for name and created_at fields to speed up filtering and ordering queries.
This commit is contained in:
sankalp committed 2026-06-30 10:41:51 +05:45
1 parent 8925c2e02d
commit fb0aab3da9
1 file changed
+6
+6
View File
@@ -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}"