mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-26 18:38:38 -06:00
Add index to features ArrayField
This commit is contained in:
parent
8fd8445f6d
commit
5fe4c96ecf
@ -1,4 +1,5 @@
|
||||
import django.contrib.postgres.fields
|
||||
import django.contrib.postgres.indexes
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
@ -48,6 +49,12 @@ class Migration(migrations.Migration):
|
||||
options={
|
||||
'verbose_name': 'object type',
|
||||
'verbose_name_plural': 'object types',
|
||||
'indexes': [
|
||||
django.contrib.postgres.indexes.GinIndex(
|
||||
fields=['features'],
|
||||
name='core_object_feature_aec4de_gin'
|
||||
),
|
||||
]
|
||||
},
|
||||
bases=('contenttypes.contenttype',),
|
||||
managers=[],
|
||||
|
@ -1,5 +1,6 @@
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.contrib.postgres.fields import ArrayField
|
||||
from django.contrib.postgres.indexes import GinIndex
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext as _
|
||||
@ -126,6 +127,9 @@ class ObjectType(ContentType):
|
||||
class Meta:
|
||||
verbose_name = _('object type')
|
||||
verbose_name_plural = _('object types')
|
||||
indexes = [
|
||||
GinIndex(fields=['features']),
|
||||
]
|
||||
|
||||
@property
|
||||
def app_labeled_name(self):
|
||||
|
Loading…
Reference in New Issue
Block a user