From 10183a9f06815e78987e43d0210a430bec44cad9 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 17 Apr 2015 11:34:44 +0100 Subject: [PATCH] only create index in sqlfindindex not during migration --- pandora/entity/migrations/0004_find.py | 4 ++-- pandora/item/management/commands/sqlfindindex.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora/entity/migrations/0004_find.py b/pandora/entity/migrations/0004_find.py index 8d6facce4..3f39d31f7 100644 --- a/pandora/entity/migrations/0004_find.py +++ b/pandora/entity/migrations/0004_find.py @@ -13,7 +13,7 @@ class Migration(SchemaMigration): ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('entity', self.gf('django.db.models.fields.related.ForeignKey')(related_name='find', to=orm['entity.Entity'])), ('key', self.gf('django.db.models.fields.CharField')(max_length=200, db_index=True)), - ('value', self.gf('django.db.models.fields.TextField')(db_index=True, blank=True)), + ('value', self.gf('django.db.models.fields.TextField')(db_index=False, blank=True)), )) db.send_create_signal('entity', ['Find']) @@ -128,7 +128,7 @@ class Migration(SchemaMigration): 'entity': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'find'", 'to': "orm['entity.Entity']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'key': ('django.db.models.fields.CharField', [], {'max_length': '200', 'db_index': 'True'}), - 'value': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'blank': 'True'}) + 'value': ('django.db.models.fields.TextField', [], {'db_index': 'False', 'blank': 'True'}) }, 'item.item': { 'Meta': {'object_name': 'Item'}, diff --git a/pandora/item/management/commands/sqlfindindex.py b/pandora/item/management/commands/sqlfindindex.py index b8099e480..7672721a1 100644 --- a/pandora/item/management/commands/sqlfindindex.py +++ b/pandora/item/management/commands/sqlfindindex.py @@ -24,7 +24,7 @@ class Command(BaseCommand): def handle(self, **options): cursor = connection.cursor() - def create_table(index, table, key): + def create_index(index, table, key): sql = 'CREATE INDEX "%s" ON "%s" USING gin ("%s" gin_trgm_ops)' % (index, table, key) if options['debug']: print sql @@ -40,5 +40,5 @@ class Command(BaseCommand): cursor = connection.cursor() indexes = connection.introspection.get_indexes(cursor, table_name) if name not in indexes: - create_table("%s_%s_idx"%(table_name, name), table_name, name) + create_index("%s_%s_idx"%(table_name, name), table_name, name) transaction.commit_unless_managed()