feat(src): add db_index to Role.name, SiteBranding.is_active, and ProjectNote.created_at

Add db_index to these fields to speed up common filter and ordering queries.
This commit is contained in:
sankalp committed 2026-06-30 10:42:45 +05:45
1 parent 554686af41
commit 1e3a1b23e5
2 files changed
+7 -1

No files matched your search

+6
View File
@@ -19,6 +19,9 @@ class Role(models.Model):
verbose_name = "Role"
verbose_name_plural = "Roles"
ordering = ["name"]
indexes = [
models.Index(fields=["name"]),
]
def __str__(self):
return self.name
@@ -108,6 +111,9 @@ class SiteBranding(models.Model):
db_table = "site_branding"
verbose_name = "Site Branding"
verbose_name_plural = "Site Branding"
indexes = [
models.Index(fields=["is_active"]),
]
def __str__(self):
return self.brand_name
+1 -1
View File
@@ -20,7 +20,7 @@ class ProjectNote(models.Model):
verbose_name = "Project Note"
verbose_name_plural = "Project Notes"
indexes = [
models.Index(fields=["project", "note_date"]),
models.Index(fields=["project", "note_date", "created_at"]),
]
def __str__(self):