Closes #20954: Add indexes for GFKs (#21015)

This commit is contained in:
Jeremy Stretch
2025-12-18 17:49:00 -05:00
committed by GitHub
parent 2eb42d4907
commit 712c743bcb
10 changed files with 111 additions and 8 deletions

View File

@@ -0,0 +1,19 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
('dcim', '0225_gfk_indexes'),
('extras', '0134_owner'),
('tenancy', '0022_add_comments_to_organizationalmodel'),
('users', '0015_owner'),
('virtualization', '0051_add_comments_to_organizationalmodel'),
]
operations = [
migrations.AddIndex(
model_name='cluster',
index=models.Index(fields=['scope_type', 'scope_id'], name='virtualizat_scope_t_fb3b6e_idx'),
),
]

View File

@@ -107,6 +107,9 @@ class Cluster(ContactsMixin, CachedScopeMixin, PrimaryModel):
name='%(app_label)s_%(class)s_unique__site_name'
),
)
indexes = (
models.Index(fields=('scope_type', 'scope_id')),
)
verbose_name = _('cluster')
verbose_name_plural = _('clusters')