diff options
21 files changed, 509 insertions, 1 deletions
| diff --git a/archaeological_context_records/migrations/0055_auto_20191216_1013.py b/archaeological_context_records/migrations/0055_auto_20191216_1013.py new file mode 100644 index 000000000..ddd2d6cc2 --- /dev/null +++ b/archaeological_context_records/migrations/0055_auto_20191216_1013.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.18 on 2019-12-16 10:13 +from __future__ import unicode_literals + +import django.contrib.postgres.fields.jsonb +from django.db import migrations + + +class Migration(migrations.Migration): + +    dependencies = [ +        ('archaeological_context_records', '0054_auto_20190910_1324'), +    ] + +    operations = [ +        migrations.AlterField( +            model_name='contextrecord', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +        migrations.AlterField( +            model_name='historicalcontextrecord', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +    ] diff --git a/archaeological_context_records/migrations/0056_auto_20191216_1031.py b/archaeological_context_records/migrations/0056_auto_20191216_1031.py new file mode 100644 index 000000000..ee2daadf8 --- /dev/null +++ b/archaeological_context_records/migrations/0056_auto_20191216_1031.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.18 on 2019-12-16 10:31 +from __future__ import unicode_literals + +import django.contrib.postgres.indexes +from django.db import migrations + + +class Migration(migrations.Migration): + +    dependencies = [ +        ('archaeological_context_records', '0055_auto_20191216_1013'), +        ('ishtar_common', '0116_create_gist_extension'), +    ] + +    operations = [ +        migrations.AddIndex( +            model_name='contextrecord', +            index=django.contrib.postgres.indexes.GinIndex(fields=['data'], name='archaeologi_data_1c3119_gin'), +        ), +    ] diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 96103600f..febc7cfdd 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -22,6 +22,7 @@ import uuid  from django.conf import settings  from django.contrib.gis.db import models +from django.contrib.postgres.indexes import GinIndex  from django.core.urlresolvers import reverse  from django.db import connection  from django.db.models import Q @@ -565,6 +566,9 @@ class ContextRecord(BulkUpdatedItem, DocumentItem, BaseHistorizedItem,              ("delete_own_contextrecord", "Can delete own Context Record"),          )          ordering = ('cached_label',) +        indexes = [ +            GinIndex(fields=['data']), +        ]      def natural_key(self):          return (self.uuid, ) diff --git a/archaeological_files/migrations/0023_auto_20191216_1013.py b/archaeological_files/migrations/0023_auto_20191216_1013.py new file mode 100644 index 000000000..bba3422cb --- /dev/null +++ b/archaeological_files/migrations/0023_auto_20191216_1013.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.18 on 2019-12-16 10:13 +from __future__ import unicode_literals + +import django.contrib.postgres.fields.jsonb +from django.db import migrations + + +class Migration(migrations.Migration): + +    dependencies = [ +        ('archaeological_files', '0022_auto_20190910_1324'), +    ] + +    operations = [ +        migrations.AlterField( +            model_name='file', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +        migrations.AlterField( +            model_name='historicalfile', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +    ] diff --git a/archaeological_files/migrations/0024_auto_20191216_1034.py b/archaeological_files/migrations/0024_auto_20191216_1034.py new file mode 100644 index 000000000..ff1473187 --- /dev/null +++ b/archaeological_files/migrations/0024_auto_20191216_1034.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.18 on 2019-12-16 10:34 +from __future__ import unicode_literals + +import django.contrib.postgres.indexes +from django.db import migrations + + +class Migration(migrations.Migration): + +    dependencies = [ +        ('archaeological_files', '0023_auto_20191216_1013'), +        ('ishtar_common', '0116_create_gist_extension'), +    ] + +    operations = [ +        migrations.AddIndex( +            model_name='file', +            index=django.contrib.postgres.indexes.GinIndex(fields=['data'], name='archaeologi_data_44e442_gin'), +        ), +    ] diff --git a/archaeological_files/models.py b/archaeological_files/models.py index dbb02f509..018b5d429 100644 --- a/archaeological_files/models.py +++ b/archaeological_files/models.py @@ -22,6 +22,7 @@ from collections import OrderedDict  from django.conf import settings  from django.contrib.gis.db import models +from django.contrib.postgres.indexes import GinIndex  from django.core.cache import cache  from django.db.models import Q, Count, Sum  from django.db.models.signals import post_save, m2m_changed, post_delete @@ -374,6 +375,9 @@ class File(ClosedItem, DocumentItem, BaseHistorizedItem, OwnPerms, ValueGetter,              ("close_file", u"Can close File"),          )          ordering = ('cached_label',) +        indexes = [ +            GinIndex(fields=['data']), +        ]      @classmethod      def _get_department_code(cls, value): diff --git a/archaeological_finds/migrations/0079_auto_20191216_1013.py b/archaeological_finds/migrations/0079_auto_20191216_1013.py new file mode 100644 index 000000000..edb4744ce --- /dev/null +++ b/archaeological_finds/migrations/0079_auto_20191216_1013.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.18 on 2019-12-16 10:13 +from __future__ import unicode_literals + +import django.contrib.postgres.fields.jsonb +from django.db import migrations + + +class Migration(migrations.Migration): + +    dependencies = [ +        ('archaeological_finds', '0078_auto_20191209_1023'), +    ] + +    operations = [ +        migrations.AlterField( +            model_name='basefind', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +        migrations.AlterField( +            model_name='find', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +        migrations.AlterField( +            model_name='historicalbasefind', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +        migrations.AlterField( +            model_name='historicalfind', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +        migrations.AlterField( +            model_name='historicaltreatment', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +        migrations.AlterField( +            model_name='historicaltreatmentfile', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +        migrations.AlterField( +            model_name='property', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +        migrations.AlterField( +            model_name='treatment', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +        migrations.AlterField( +            model_name='treatmentfile', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +    ] diff --git a/archaeological_finds/migrations/0080_auto_20191216_1040.py b/archaeological_finds/migrations/0080_auto_20191216_1040.py new file mode 100644 index 000000000..190ebcd47 --- /dev/null +++ b/archaeological_finds/migrations/0080_auto_20191216_1040.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.18 on 2019-12-16 10:40 +from __future__ import unicode_literals + +import django.contrib.postgres.indexes +from django.db import migrations + + +class Migration(migrations.Migration): + +    dependencies = [ +        ('ishtar_common', '0116_create_gist_extension'), +        ('archaeological_finds', '0079_auto_20191216_1013'), +    ] + +    operations = [ +        migrations.AddIndex( +            model_name='treatment', +            index=django.contrib.postgres.indexes.GinIndex(fields=['data'], name='archaeologi_data_011f1a_gin'), +        ), +        migrations.AddIndex( +            model_name='treatmentfile', +            index=django.contrib.postgres.indexes.GinIndex(fields=['data'], name='archaeologi_data_4ecdf7_gin'), +        ), +        migrations.AddIndex( +            model_name='basefind', +            index=django.contrib.postgres.indexes.GinIndex(fields=['data'], name='archaeologi_data_fb3df5_gin'), +        ), +        migrations.AddIndex( +            model_name='find', +            index=django.contrib.postgres.indexes.GinIndex(fields=['data'], name='archaeologi_data_622f41_gin'), +        ), +        migrations.AddIndex( +            model_name='property', +            index=django.contrib.postgres.indexes.GinIndex(fields=['data'], name='archaeologi_data_cb9c09_gin'), +        ), +    ] diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index c5bca5fb6..d9ebe9dfe 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -23,6 +23,7 @@ import uuid  from django.conf import settings  from django.contrib.gis.db import models +from django.contrib.postgres.indexes import GinIndex  from django.core.urlresolvers import reverse  from django.db import connection  from django.db.models import Max, Q, F @@ -330,6 +331,9 @@ class BaseFind(BulkUpdatedItem, BaseHistorizedItem, GeoItem, OwnPerms,              ("change_own_basefind", u"Can change own Base find"),              ("delete_own_basefind", u"Can delete own Base find"),          ) +        indexes = [ +            GinIndex(fields=['data']), +        ]      def __str__(self):          return self.label @@ -1652,6 +1656,9 @@ class Find(BulkUpdatedItem, ValueGetter, DocumentItem, BaseHistorizedItem,              ("delete_own_find", u"Can delete own Find"),          )          ordering = ('cached_label',) +        indexes = [ +            GinIndex(fields=['data']), +        ]      def natural_key(self):          return (self.uuid, ) @@ -2532,6 +2539,9 @@ class Property(LightHistorizedItem):      class Meta:          verbose_name = _(u"Property")          verbose_name_plural = _(u"Properties") +        indexes = [ +            GinIndex(fields=['data']), +        ]      def __str__(self):          return str(self.person) + settings.JOINT + str(self.find) diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index f09343c46..1f2ad1c0f 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -21,6 +21,7 @@ import datetime  from django.conf import settings  from django.contrib.gis.db import models +from django.contrib.postgres.indexes import GinIndex  from django.core.urlresolvers import reverse  from django.db.models import Max, Q  from django.db.models.signals import post_save, post_delete, pre_delete, \ @@ -229,6 +230,9 @@ class Treatment(DashboardFormItem, ValueGetter, DocumentItem,              ("delete_own_treatment", u"Can delete own Treatment"),          )          ordering = ("-year", "-index", "-start_date") +        indexes = [ +            GinIndex(fields=['data']), +        ]      def __str__(self):          return self.cached_label or "" @@ -1030,6 +1034,9 @@ class TreatmentFile(DashboardFormItem, ClosedItem, DocumentItem,               u"Can delete own Treatment request"),          )          ordering = ('cached_label',) +        indexes = [ +            GinIndex(fields=['data']), +        ]      def __str__(self):          return self.cached_label or "" diff --git a/archaeological_operations/migrations/0074_auto_20191216_1013.py b/archaeological_operations/migrations/0074_auto_20191216_1013.py new file mode 100644 index 000000000..f39299b76 --- /dev/null +++ b/archaeological_operations/migrations/0074_auto_20191216_1013.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.18 on 2019-12-16 10:13 +from __future__ import unicode_literals + +import django.contrib.postgres.fields.jsonb +from django.db import migrations + + +class Migration(migrations.Migration): + +    dependencies = [ +        ('archaeological_operations', '0073_auto_20191209_1058'), +    ] + +    operations = [ +        migrations.AlterField( +            model_name='administrativeact', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +        migrations.AlterField( +            model_name='archaeologicalsite', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +        migrations.AlterField( +            model_name='historicaladministrativeact', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +        migrations.AlterField( +            model_name='historicalarchaeologicalsite', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +        migrations.AlterField( +            model_name='historicaloperation', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +        migrations.AlterField( +            model_name='operation', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +        migrations.AlterField( +            model_name='parcel', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +        migrations.AlterField( +            model_name='parcelowner', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +    ] diff --git a/archaeological_operations/migrations/0075_auto_20191216_1045.py b/archaeological_operations/migrations/0075_auto_20191216_1045.py new file mode 100644 index 000000000..615927e43 --- /dev/null +++ b/archaeological_operations/migrations/0075_auto_20191216_1045.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.18 on 2019-12-16 10:45 +from __future__ import unicode_literals + +import django.contrib.postgres.indexes +from django.db import migrations + + +class Migration(migrations.Migration): + +    dependencies = [ +        ('archaeological_operations', '0074_auto_20191216_1013'), +        ('ishtar_common', '0116_create_gist_extension'), +    ] + +    operations = [ +        migrations.AddIndex( +            model_name='administrativeact', +            index=django.contrib.postgres.indexes.GinIndex(fields=['data'], name='archaeologi_data_587bb3_gin'), +        ), +        migrations.AddIndex( +            model_name='parcel', +            index=django.contrib.postgres.indexes.GinIndex(fields=['data'], name='archaeologi_data_835f5e_gin'), +        ), +        migrations.AddIndex( +            model_name='operation', +            index=django.contrib.postgres.indexes.GinIndex(fields=['data'], name='archaeologi_data_8d8f9f_gin'), +        ), +        migrations.AddIndex( +            model_name='archaeologicalsite', +            index=django.contrib.postgres.indexes.GinIndex(fields=['data'], name='archaeologi_data_071fb5_gin'), +        ), +        migrations.AddIndex( +            model_name='parcelowner', +            index=django.contrib.postgres.indexes.GinIndex(fields=['data'], name='archaeologi_data_457021_gin'), +        ), +    ] diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 81dd076a8..ef81acdc9 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -26,6 +26,7 @@ from django.conf import settings  from django.contrib.gis.db import models  from django.contrib.gis.db.models.aggregates import Union  from django.contrib.gis.db.models.functions import Centroid +from django.contrib.postgres.indexes import GinIndex  from django.core.urlresolvers import reverse  from django.db import IntegrityError, transaction  from django.db.models import Q, Count, Sum, Max, Avg @@ -367,6 +368,9 @@ class ArchaeologicalSite(DocumentItem, BaseHistorizedItem, QRCodeItem,              ("delete_own_archaeologicalsite",               "Can delete own Archaeological site"),          ) +        indexes = [ +            GinIndex(fields=['data']), +        ]      def __str__(self):          return self.cached_label or '' @@ -1124,6 +1128,9 @@ class Operation(ClosedItem, DocumentItem, BaseHistorizedItem, QRCodeItem,              ("close_operation", "Can close Operation"),          )          ordering = ('cached_label',) +        indexes = [ +            GinIndex(fields=['data']), +        ]      def natural_key(self):          return (self.uuid, ) @@ -2099,6 +2106,9 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter):              ("delete_own_administrativeact",               "Can delete own Administrative act"),          ) +        indexes = [ +            GinIndex(fields=['data']), +        ]      @property      def DELETE_URL(self): @@ -2317,6 +2327,9 @@ class Parcel(LightHistorizedItem):          verbose_name = _("Parcel")          verbose_name_plural = _("Parcels")          ordering = ('year', 'section', 'parcel_number') +        indexes = [ +            GinIndex(fields=['data']), +        ]      @property      def short_label(self): @@ -2533,6 +2546,9 @@ class ParcelOwner(LightHistorizedItem):      class Meta:          verbose_name = _("Parcel owner")          verbose_name_plural = _("Parcel owners") +        indexes = [ +            GinIndex(fields=['data']), +        ]      def __str__(self):          return "{}{}{}".format(self.owner, settings.JOINT, self.parcel) diff --git a/archaeological_warehouse/migrations/0042_auto_20191216_1014.py b/archaeological_warehouse/migrations/0042_auto_20191216_1014.py new file mode 100644 index 000000000..cf403284b --- /dev/null +++ b/archaeological_warehouse/migrations/0042_auto_20191216_1014.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.18 on 2019-12-16 10:14 +from __future__ import unicode_literals + +import django.contrib.postgres.fields.jsonb +from django.db import migrations + + +class Migration(migrations.Migration): + +    dependencies = [ +        ('archaeological_warehouse', '0041_auto_20190912_1518'), +    ] + +    operations = [ +        migrations.AlterField( +            model_name='collection', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +        migrations.AlterField( +            model_name='container', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +        migrations.AlterField( +            model_name='warehouse', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +    ] diff --git a/archaeological_warehouse/migrations/0043_auto_20191216_1027.py b/archaeological_warehouse/migrations/0043_auto_20191216_1027.py new file mode 100644 index 000000000..e918ca490 --- /dev/null +++ b/archaeological_warehouse/migrations/0043_auto_20191216_1027.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.18 on 2019-12-16 10:27 +from __future__ import unicode_literals + +import django.contrib.postgres.indexes +from django.db import migrations + + +class Migration(migrations.Migration): + +    dependencies = [ +        ('ishtar_common', '0116_create_gist_extension'), +        ('archaeological_warehouse', '0042_auto_20191216_1014'), +    ] + +    operations = [ +        migrations.AddIndex( +            model_name='warehouse', +            index=django.contrib.postgres.indexes.GinIndex(fields=['data'], name='archaeologi_data_49b6ad_gin'), +        ), +    ] diff --git a/archaeological_warehouse/migrations/0044_auto_20191216_1050.py b/archaeological_warehouse/migrations/0044_auto_20191216_1050.py new file mode 100644 index 000000000..2794079f1 --- /dev/null +++ b/archaeological_warehouse/migrations/0044_auto_20191216_1050.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.18 on 2019-12-16 10:50 +from __future__ import unicode_literals + +import django.contrib.postgres.indexes +from django.db import migrations + + +class Migration(migrations.Migration): + +    dependencies = [ +        ('archaeological_warehouse', '0043_auto_20191216_1027'), +    ] + +    operations = [ +        migrations.AddIndex( +            model_name='collection', +            index=django.contrib.postgres.indexes.GinIndex(fields=['data'], name='archaeologi_data_4a4a83_gin'), +        ), +        migrations.AddIndex( +            model_name='container', +            index=django.contrib.postgres.indexes.GinIndex(fields=['data'], name='archaeologi_data_edae47_gin'), +        ), +    ] diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index de567d26e..64a766cea 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -22,6 +22,7 @@ import uuid  from django.conf import settings  from django.contrib.gis.db import models +from django.contrib.postgres.indexes import GinIndex  from django.core.urlresolvers import reverse  from django.db.models import Q, Max  from django.db.models.signals import post_save, post_delete, m2m_changed @@ -134,6 +135,9 @@ class Warehouse(Address, DocumentItem, GeoItem, QRCodeItem, DashboardFormItem,              ("change_own_warehouse", u"Can change own Warehouse"),              ("delete_own_warehouse", u"Can delete own Warehouse"),          ) +        indexes = [ +            GinIndex(fields=['data']), +        ]      def __str__(self):          return self.name @@ -359,6 +363,9 @@ class Collection(LightHistorizedItem):          verbose_name = _(u"Collection")          verbose_name_plural = _(u"Collection")          ordering = ('name',) +        indexes = [ +            GinIndex(fields=['data']), +        ]      def __str__(self):          return self.name @@ -639,6 +646,9 @@ class Container(DocumentItem, LightHistorizedItem, QRCodeItem, GeoItem,              ("change_own_container", u"Can change own Container"),              ("delete_own_container", u"Can delete own Container"),          ) +        indexes = [ +            GinIndex(fields=['data']), +        ]      def __str__(self):          return self.cached_label or "" diff --git a/ishtar_common/migrations/0115_auto_20191216_1013.py b/ishtar_common/migrations/0115_auto_20191216_1013.py new file mode 100644 index 000000000..1da9e4dbd --- /dev/null +++ b/ishtar_common/migrations/0115_auto_20191216_1013.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.18 on 2019-12-16 10:13 +from __future__ import unicode_literals + +import django.contrib.postgres.fields.jsonb +from django.db import migrations + + +class Migration(migrations.Migration): + +    dependencies = [ +        ('ishtar_common', '0114_auto_20191212_1726'), +    ] + +    operations = [ +        migrations.AlterField( +            model_name='document', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +        migrations.AlterField( +            model_name='historicalorganization', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +        migrations.AlterField( +            model_name='historicalperson', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +        migrations.AlterField( +            model_name='organization', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +        migrations.AlterField( +            model_name='person', +            name='data', +            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}), +        ), +    ] diff --git a/ishtar_common/migrations/0116_create_gist_extension.py b/ishtar_common/migrations/0116_create_gist_extension.py new file mode 100644 index 000000000..cc22e3909 --- /dev/null +++ b/ishtar_common/migrations/0116_create_gist_extension.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.18 on 2019-12-16 10:18 +from __future__ import unicode_literals + +from django.db import migrations +from django.contrib.postgres.operations import BtreeGinExtension + + +class Migration(migrations.Migration): + +    dependencies = [ +        ('ishtar_common', '0115_auto_20191216_1013'), +    ] + +    operations = [ +        BtreeGinExtension() +    ] diff --git a/ishtar_common/migrations/0117_auto_20191216_1027.py b/ishtar_common/migrations/0117_auto_20191216_1027.py new file mode 100644 index 000000000..221f24e21 --- /dev/null +++ b/ishtar_common/migrations/0117_auto_20191216_1027.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.18 on 2019-12-16 10:27 +from __future__ import unicode_literals + +import django.contrib.postgres.indexes +from django.db import migrations + + +class Migration(migrations.Migration): + +    dependencies = [ +        ('ishtar_common', '0116_create_gist_extension'), +    ] + +    operations = [ +        migrations.AddIndex( +            model_name='person', +            index=django.contrib.postgres.indexes.GinIndex(fields=['data'], name='ishtar_comm_data_a563fb_gin'), +        ), +        migrations.AddIndex( +            model_name='document', +            index=django.contrib.postgres.indexes.GinIndex(fields=['data'], name='ishtar_comm_data_c6da6f_gin'), +        ), +        migrations.AddIndex( +            model_name='organization', +            index=django.contrib.postgres.indexes.GinIndex(fields=['data'], name='ishtar_comm_data_36ecc0_gin'), +        ), +    ] diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 04ac2ef38..22b6cac33 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -52,6 +52,7 @@ from django.contrib.contenttypes.models import ContentType  from django.contrib.gis.db import models  from django.contrib.postgres.fields import JSONField  from django.contrib.postgres.search import SearchVectorField, SearchVector +from django.contrib.postgres.indexes import GinIndex  from django.contrib.sites.models import Site  from django.core.cache import cache  from django.core.exceptions import ObjectDoesNotExist, ValidationError, \ @@ -1370,7 +1371,7 @@ class JsonDataField(models.Model):  class JsonData(models.Model, CachedGen): -    data = JSONField(default={}, db_index=True, blank=True) +    data = JSONField(default={}, blank=True)      class Meta:          abstract = True @@ -4129,6 +4130,9 @@ class Organization(Address, Merge, OwnPerms, ValueGetter, MainItem):              ("change_own_organization", "Can change own Organization"),              ("delete_own_organization", "Can delete own Organization"),          ) +        indexes = [ +            GinIndex(fields=['data']), +        ]      def simple_lbl(self):          if self.name: @@ -4299,6 +4303,9 @@ class Person(Address, Merge, OwnPerms, ValueGetter, MainItem):      class Meta:          verbose_name = _("Person")          verbose_name_plural = _("Persons") +        indexes = [ +            GinIndex(fields=['data']), +        ]          permissions = (              ("view_person", "Can view all Persons"),              ("view_own_person", "Can view own Person"), @@ -5248,6 +5255,9 @@ class Document(BaseHistorizedItem, QRCodeItem, OwnPerms, ImageModel,              ("delete_own_document",               ugettext("Can delete own Document")),          ) +        indexes = [ +            GinIndex(fields=['data']), +        ]      def __str__(self):          return self.title | 
