diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-10-12 13:17:17 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-10-12 13:17:17 +0200 |
commit | d658fbb5b55c6ce318383b535732763e810b6537 (patch) | |
tree | 7d3f57ec13a117bbbaa8cd9e5117b2478456cd0f | |
parent | 0c75a8c1300338ce0a03d3a1bb57959f48eaaf1a (diff) | |
download | Ishtar-d658fbb5b55c6ce318383b535732763e810b6537.tar.bz2 Ishtar-d658fbb5b55c6ce318383b535732763e810b6537.zip |
Performance: add indexes for cached labels
-rw-r--r-- | archaeological_context_records/migrations/0011_auto_20171012_1316.py | 25 | ||||
-rw-r--r-- | archaeological_context_records/models.py | 3 | ||||
-rw-r--r-- | archaeological_files/migrations/0009_auto_20171012_1316.py | 25 | ||||
-rw-r--r-- | archaeological_files/models.py | 3 | ||||
-rw-r--r-- | archaeological_finds/migrations/0011_auto_20171012_1316.py | 65 | ||||
-rw-r--r-- | archaeological_finds/models_finds.py | 7 | ||||
-rw-r--r-- | archaeological_finds/models_treatments.py | 6 | ||||
-rw-r--r-- | archaeological_operations/migrations/0010_auto_20171012_1316.py | 25 | ||||
-rw-r--r-- | archaeological_operations/models.py | 2 | ||||
-rw-r--r-- | archaeological_warehouse/migrations/0009_auto_20171012_1316.py | 25 | ||||
-rw-r--r-- | archaeological_warehouse/models.py | 4 |
11 files changed, 180 insertions, 10 deletions
diff --git a/archaeological_context_records/migrations/0011_auto_20171012_1316.py b/archaeological_context_records/migrations/0011_auto_20171012_1316.py new file mode 100644 index 000000000..95b042c43 --- /dev/null +++ b/archaeological_context_records/migrations/0011_auto_20171012_1316.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11 on 2017-10-12 13:16 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('archaeological_context_records', '0010_auto_20171011_1644'), + ] + + operations = [ + migrations.AlterField( + model_name='contextrecord', + name='cached_label', + field=models.TextField(blank=True, db_index=True, null=True, verbose_name='Cached name'), + ), + migrations.AlterField( + model_name='historicalcontextrecord', + name='cached_label', + field=models.TextField(blank=True, db_index=True, null=True, verbose_name='Cached name'), + ), + ] diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 2f02ed9df..9162a8aa0 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -302,7 +302,8 @@ class ContextRecord(BulkUpdatedItem, BaseHistorizedItem, point_2d = models.PointField(_(u"Point (2D)"), blank=True, null=True) point = models.PointField(_(u"Point (3D)"), blank=True, null=True, dim=3) polygon = models.PolygonField(_(u"Polygon"), blank=True, null=True) - cached_label = models.TextField(_(u"Cached name"), null=True, blank=True) + cached_label = models.TextField(_(u"Cached name"), null=True, blank=True, + db_index=True) history = HistoricalRecords() class Meta: diff --git a/archaeological_files/migrations/0009_auto_20171012_1316.py b/archaeological_files/migrations/0009_auto_20171012_1316.py new file mode 100644 index 000000000..cd33d8243 --- /dev/null +++ b/archaeological_files/migrations/0009_auto_20171012_1316.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11 on 2017-10-12 13:16 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('archaeological_files', '0008_auto_20171011_1644'), + ] + + operations = [ + migrations.AlterField( + model_name='file', + name='cached_label', + field=models.TextField(blank=True, db_index=True, null=True, verbose_name='Cached name'), + ), + migrations.AlterField( + model_name='historicalfile', + name='cached_label', + field=models.TextField(blank=True, db_index=True, null=True, verbose_name='Cached name'), + ), + ] diff --git a/archaeological_files/models.py b/archaeological_files/models.py index 0d5b4b3e8..b0f53f11c 100644 --- a/archaeological_files/models.py +++ b/archaeological_files/models.py @@ -204,7 +204,8 @@ class File(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter, mh_listing = models.NullBooleanField( u"Sur Monument Historique inscrit", blank=True, null=True) # <-- research archaeology - cached_label = models.TextField(_(u"Cached name"), null=True, blank=True) + cached_label = models.TextField(_(u"Cached name"), null=True, blank=True, + db_index=True) imported_line = models.TextField(_(u"Imported line"), null=True, blank=True) history = HistoricalRecords() diff --git a/archaeological_finds/migrations/0011_auto_20171012_1316.py b/archaeological_finds/migrations/0011_auto_20171012_1316.py new file mode 100644 index 000000000..6fabd578f --- /dev/null +++ b/archaeological_finds/migrations/0011_auto_20171012_1316.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11 on 2017-10-12 13:16 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('archaeological_finds', '0010_auto_20171011_1644'), + ] + + operations = [ + migrations.AlterField( + model_name='basefind', + name='cache_complete_id', + field=models.TextField(blank=True, db_index=True, help_text='Cached value - do not edit', null=True, verbose_name='Complete ID'), + ), + migrations.AlterField( + model_name='basefind', + name='cache_short_id', + field=models.TextField(blank=True, db_index=True, help_text='Cached value - do not edit', null=True, verbose_name='Short ID'), + ), + migrations.AlterField( + model_name='find', + name='cached_label', + field=models.TextField(blank=True, db_index=True, null=True, verbose_name='Cached name'), + ), + migrations.AlterField( + model_name='historicalbasefind', + name='cache_complete_id', + field=models.TextField(blank=True, db_index=True, help_text='Cached value - do not edit', null=True, verbose_name='Complete ID'), + ), + migrations.AlterField( + model_name='historicalbasefind', + name='cache_short_id', + field=models.TextField(blank=True, db_index=True, help_text='Cached value - do not edit', null=True, verbose_name='Short ID'), + ), + migrations.AlterField( + model_name='historicalfind', + name='cached_label', + field=models.TextField(blank=True, db_index=True, null=True, verbose_name='Cached name'), + ), + migrations.AlterField( + model_name='historicaltreatment', + name='cached_label', + field=models.TextField(blank=True, db_index=True, null=True, verbose_name='Cached name'), + ), + migrations.AlterField( + model_name='historicaltreatmentfile', + name='cached_label', + field=models.TextField(blank=True, db_index=True, null=True, verbose_name='Cached name'), + ), + migrations.AlterField( + model_name='treatment', + name='cached_label', + field=models.TextField(blank=True, db_index=True, null=True, verbose_name='Cached name'), + ), + migrations.AlterField( + model_name='treatmentfile', + name='cached_label', + field=models.TextField(blank=True, db_index=True, null=True, verbose_name='Cached name'), + ), + ] diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index e58d14f7e..966dd1065 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -231,10 +231,10 @@ class BaseFind(BulkUpdatedItem, BaseHistorizedItem, OwnPerms): line = models.LineStringField(_(u"Line"), blank=True, null=True) polygon = models.PolygonField(_(u"Polygon"), blank=True, null=True) cache_short_id = models.TextField( - _(u"Short ID"), blank=True, null=True, + _(u"Short ID"), blank=True, null=True, db_index=True, help_text=_(u"Cached value - do not edit")) cache_complete_id = models.TextField( - _(u"Complete ID"), blank=True, null=True, + _(u"Complete ID"), blank=True, null=True, db_index=True, help_text=_(u"Cached value - do not edit")) history = HistoricalRecords() RELATED_POST_PROCESS = ['find'] @@ -748,7 +748,8 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, ImageModel, appraisal_date = models.DateField(_(u"Appraisal date"), blank=True, null=True) - cached_label = models.TextField(_(u"Cached name"), null=True, blank=True) + cached_label = models.TextField(_(u"Cached name"), null=True, blank=True, + db_index=True) history = HistoricalRecords() BASKET_MODEL = FindBasket diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index 0ffcd87fa..b4d98528b 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -115,7 +115,8 @@ class Treatment(DashboardFormItem, ValueGetter, BaseHistorizedItem, blank=True, null=True) target_is_basket = models.BooleanField(_(u"Target a basket"), default=False) - cached_label = models.TextField(_(u"Cached name"), null=True, blank=True) + cached_label = models.TextField(_(u"Cached name"), null=True, blank=True, + db_index=True) history = HistoricalRecords() class Meta: @@ -506,7 +507,8 @@ class TreatmentFile(DashboardFormItem, ClosedItem, BaseHistorizedItem, reception_date = models.DateField(_(u'Reception date'), blank=True, null=True) comment = models.TextField(_(u"Comment"), null=True, blank=True) - cached_label = models.TextField(_(u"Cached name"), null=True, blank=True) + cached_label = models.TextField(_(u"Cached name"), null=True, blank=True, + db_index=True) history = HistoricalRecords() class Meta: diff --git a/archaeological_operations/migrations/0010_auto_20171012_1316.py b/archaeological_operations/migrations/0010_auto_20171012_1316.py new file mode 100644 index 000000000..3a847a803 --- /dev/null +++ b/archaeological_operations/migrations/0010_auto_20171012_1316.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11 on 2017-10-12 13:16 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('archaeological_operations', '0009_auto_20171011_1644'), + ] + + operations = [ + migrations.AlterField( + model_name='historicaloperation', + name='cached_label', + field=models.CharField(blank=True, db_index=True, max_length=500, null=True, verbose_name='Cached name'), + ), + migrations.AlterField( + model_name='operation', + name='cached_label', + field=models.CharField(blank=True, db_index=True, max_length=500, null=True, verbose_name='Cached name'), + ), + ] diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index d55a2e689..dd3e65534 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -345,7 +345,7 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms, scientific_documentation_comment = models.TextField( _(u"Comment about scientific documentation"), null=True, blank=True) cached_label = models.CharField(_(u"Cached name"), max_length=500, - null=True, blank=True) + null=True, blank=True, db_index=True) archaeological_sites = models.ManyToManyField( ArchaeologicalSite, verbose_name=_(u"Archaeological sites"), blank=True, related_name='operations') diff --git a/archaeological_warehouse/migrations/0009_auto_20171012_1316.py b/archaeological_warehouse/migrations/0009_auto_20171012_1316.py new file mode 100644 index 000000000..a25a2d2f2 --- /dev/null +++ b/archaeological_warehouse/migrations/0009_auto_20171012_1316.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11 on 2017-10-12 13:16 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('archaeological_warehouse', '0008_auto_20171011_1644'), + ] + + operations = [ + migrations.AlterField( + model_name='container', + name='cached_label', + field=models.CharField(blank=True, db_index=True, max_length=500, null=True, verbose_name='Localisation'), + ), + migrations.AlterField( + model_name='container', + name='cached_location', + field=models.CharField(blank=True, db_index=True, max_length=500, null=True, verbose_name='Cached location'), + ), + ] diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index 41891b341..71f31981a 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -283,9 +283,9 @@ class Container(LightHistorizedItem, ImageModel): reference = models.CharField(_(u"Container ref."), max_length=40) comment = models.TextField(_(u"Comment"), null=True, blank=True) cached_label = models.CharField(_(u"Localisation"), max_length=500, - null=True, blank=True) + null=True, blank=True, db_index=True) cached_location = models.CharField(_(u"Cached location"), max_length=500, - null=True, blank=True) + null=True, blank=True, db_index=True) index = models.IntegerField(u"Container ID", default=0) external_id = models.TextField(_(u"External ID"), blank=True, null=True) auto_external_id = models.BooleanField( |