mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-23 13:52:17 -06:00
* Closes #14436: Add PostgreSQL indexes for all GenericForeignKeys * Add note about GFK indexes to developer docs
This commit is contained in:
@@ -219,6 +219,10 @@ class Migration(migrations.Migration):
|
||||
'ordering': ('tunnel', 'role', 'pk'),
|
||||
},
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='tunneltermination',
|
||||
index=models.Index(fields=['termination_type', 'termination_id'], name='vpn_tunnelt_termina_c1f04b_idx'),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='tunneltermination',
|
||||
constraint=models.UniqueConstraint(fields=('termination_type', 'termination_id'), name='vpn_tunneltermination_termination', violation_error_message='An object may be terminated to only one tunnel at a time.'),
|
||||
|
||||
@@ -70,4 +70,8 @@ class Migration(migrations.Migration):
|
||||
name='vpn_l2vpntermination_assigned_object'
|
||||
),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='l2vpntermination',
|
||||
index=models.Index(fields=['assigned_object_type', 'assigned_object_id'], name='vpn_l2vpnte_assigne_9c55f8_idx'),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -104,6 +104,9 @@ class L2VPNTermination(NetBoxModel):
|
||||
|
||||
class Meta:
|
||||
ordering = ('l2vpn',)
|
||||
indexes = (
|
||||
models.Index(fields=('assigned_object_type', 'assigned_object_id')),
|
||||
)
|
||||
constraints = (
|
||||
models.UniqueConstraint(
|
||||
fields=('assigned_object_type', 'assigned_object_id'),
|
||||
|
||||
@@ -143,6 +143,9 @@ class TunnelTermination(CustomFieldsMixin, CustomLinksMixin, TagsMixin, ChangeLo
|
||||
|
||||
class Meta:
|
||||
ordering = ('tunnel', 'role', 'pk')
|
||||
indexes = (
|
||||
models.Index(fields=('termination_type', 'termination_id')),
|
||||
)
|
||||
constraints = (
|
||||
models.UniqueConstraint(
|
||||
fields=('termination_type', 'termination_id'),
|
||||
|
||||
Reference in New Issue
Block a user