Added db index to siteinterfacedictionary text for optimize
This commit is contained in:
parent
be96a6c7ba
commit
51114b0e95
18
apps/translation/migrations/0008_index_siteifdict_text.py
Normal file
18
apps/translation/migrations/0008_index_siteifdict_text.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 2.2.7 on 2020-01-17 22:01
|
||||
|
||||
import django.contrib.postgres.indexes
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('translation', '0007_language_is_active'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddIndex(
|
||||
model_name='siteinterfacedictionary',
|
||||
index=django.contrib.postgres.indexes.GinIndex(fields=['text'], name='translation_text_0b2bfa_gin'),
|
||||
),
|
||||
]
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
"""Translation app models."""
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.contrib.postgres.indexes import GinIndex
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.apps import apps
|
||||
|
|
@ -105,6 +106,9 @@ class SiteInterfaceDictionary(ProjectBaseMixin):
|
|||
|
||||
verbose_name = _('Site interface dictionary')
|
||||
verbose_name_plural = _('Site interface dictionary')
|
||||
indexes = [
|
||||
GinIndex(fields=['text'])
|
||||
]
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.page}: {self.keywords}'
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user