mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-11 03:37:06 +02:00
* Closes #14436: Add PostgreSQL indexes for all GenericForeignKeys * Add note about GFK indexes to developer docs
This commit is contained in:
17
netbox/tenancy/migrations/0013_gfk_indexes.py
Normal file
17
netbox/tenancy/migrations/0013_gfk_indexes.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# Generated by Django 4.2.7 on 2023-12-07 16:09
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('tenancy', '0012_contactassignment_custom_fields'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddIndex(
|
||||
model_name='contactassignment',
|
||||
index=models.Index(fields=['content_type', 'object_id'], name='tenancy_con_content_693ff4_idx'),
|
||||
),
|
||||
]
|
||||
@@ -141,6 +141,9 @@ class ContactAssignment(CustomFieldsMixin, ExportTemplatesMixin, TagsMixin, Chan
|
||||
|
||||
class Meta:
|
||||
ordering = ('priority', 'contact')
|
||||
indexes = (
|
||||
models.Index(fields=('content_type', 'object_id')),
|
||||
)
|
||||
constraints = (
|
||||
models.UniqueConstraint(
|
||||
fields=('content_type', 'object_id', 'contact', 'role'),
|
||||
|
||||
Reference in New Issue
Block a user