Skip to content

Commit

Permalink
added index on cachevalue #14966
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi1693 committed Feb 20, 2024
1 parent d216161 commit dd7a113
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.9 on 2024-02-20 17:15

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('extras', '0106_bookmark_user_cascade_deletion'),
]

operations = [
migrations.AddIndex(
model_name='cachedvalue',
index=models.Index(fields=['object_type', 'object_id'], name='extras_cach_object__d92213_idx'),
),
]
3 changes: 3 additions & 0 deletions netbox/extras/models/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class Meta:
ordering = ('weight', 'object_type', 'value', 'object_id')
verbose_name = _('cached value')
verbose_name_plural = _('cached values')
indexes = (
models.Index(fields=('object_type', 'object_id')),
)

def __str__(self):
return f'{self.object_type} {self.object_id}: {self.field}={self.value}'
Expand Down

0 comments on commit dd7a113

Please sign in to comment.