Add indexes for value field

This commit is contained in:
jeremystretch 2022-10-17 16:40:50 -04:00
parent eb1557c171
commit 4fff0996ab
3 changed files with 9 additions and 23 deletions

View File

@ -1,5 +1,3 @@
# Generated by Django 4.1.1 on 2022-10-10 18:22
from django.db import migrations, models
import django.db.models.deletion
@ -20,7 +18,7 @@ class Migration(migrations.Migration):
('object_id', models.PositiveBigIntegerField()),
('field', models.CharField(max_length=200)),
('type', models.CharField(max_length=30)),
('value', models.TextField()),
('value', models.TextField(db_index=True)),
('weight', models.PositiveSmallIntegerField(default=1000)),
('object_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='contenttypes.contenttype')),
],
@ -28,4 +26,9 @@ class Migration(migrations.Migration):
'ordering': ('weight', 'object_type', 'object_id'),
},
),
migrations.AddField(
model_name='customfield',
name='search_weight',
field=models.PositiveSmallIntegerField(default=1000),
),
]

View File

@ -1,18 +0,0 @@
# Generated by Django 4.1.1 on 2022-10-12 13:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('extras', '0079_search'),
]
operations = [
migrations.AddField(
model_name='customfield',
name='search_weight',
field=models.PositiveSmallIntegerField(default=1000),
),
]

View File

@ -1,4 +1,3 @@
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
@ -30,7 +29,9 @@ class CachedValue(models.Model):
type = models.CharField(
max_length=30
)
value = models.TextField()
value = models.TextField(
db_index=True
)
weight = models.PositiveSmallIntegerField(
default=1000
)