perf(db): add targeted composite indexes
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# 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 = [
|
||||
('workspaces', '0006_workspace_thumbnail'),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddIndex(
|
||||
model_name='workspacemembership',
|
||||
index=models.Index(fields=['workspace', 'is_active', 'user'], name='membership_ws_active_user_idx'),
|
||||
),
|
||||
]
|
||||
@@ -80,6 +80,7 @@ class WorkspaceMembership(BaseModel):
|
||||
indexes = [
|
||||
models.Index(fields=["workspace"], name="membership_workspace_idx"),
|
||||
models.Index(fields=["user"], name="membership_user_idx"),
|
||||
models.Index(fields=["workspace", "is_active", "user"], name="membership_ws_active_user_idx"),
|
||||
]
|
||||
constraints = [
|
||||
models.UniqueConstraint(
|
||||
|
||||
Reference in New Issue
Block a user