perf(db): add targeted composite indexes

This commit is contained in:
2026-04-30 16:13:35 +03:30
parent 054bb5a582
commit 99eb4c2594
6 changed files with 72 additions and 7 deletions

View File

@@ -0,0 +1,21 @@
# Generated by Django 5.2.12 on 2026-04-30 12:23
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('clients', '0001_initial'),
('projects', '0002_remove_projectmembership'),
('workspaces', '0007_workspacemembership_membership_ws_active_user_idx'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.AddIndex(
model_name='project',
index=models.Index(fields=['workspace', 'is_archived', 'updated_at'], name='project_ws_arch_upd_idx'),
),
]

View File

@@ -37,6 +37,7 @@ class Project(BaseModel):
ordering = ("-updated_at", "-created_at")
indexes = [
models.Index(fields=["workspace"], name="project_workspace_idx"),
models.Index(fields=["workspace", "is_archived", "updated_at"], name="project_ws_arch_upd_idx"),
]
constraints = [
models.UniqueConstraint(