From 577afd682e4976734cd420b311818c5c08399f3b Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 27 Mar 2012 13:26:51 +0200 Subject: [PATCH] only add index flag if DB_GIN_TRGM is set --- pandora/clip/models.py | 2 +- pandora/item/models.py | 2 +- pandora/settings.py | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pandora/clip/models.py b/pandora/clip/models.py index 6c87121d..1b00bc2c 100644 --- a/pandora/clip/models.py +++ b/pandora/clip/models.py @@ -133,7 +133,7 @@ attrs = { 'sortvalue': models.CharField(max_length=1000, null=True, db_index=True), #run this CREATE INDEX clip_clip_findvalue_idx ON clip_clip USING gin (findvalue gin_trgm_ops); - 'findvalue': models.TextField(null=True, db_index=True), + 'findvalue': models.TextField(null=True, db_index=settings.DB_GIN_TRGM), } for name in settings.CONFIG['clipLayers']: attrs[name] = models.BooleanField(default=False, db_index=True) diff --git a/pandora/item/models.py b/pandora/item/models.py index ddeffb58..f66e5f37 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -1295,7 +1295,7 @@ class ItemFind(models.Model): item = models.ForeignKey('Item', related_name='find', db_index=True) key = models.CharField(max_length=200, db_index=True) #CREATE INDEX item_itemfind_value_idx ON item_itemfind USING gin (value gin_trgm_ops); - value = models.TextField(blank=True, db_index=True) + value = models.TextField(blank=True, db_index=settings.DB_GIN_TRGM) def __unicode__(self): return u"%s=%s" % (self.key, self.value) diff --git a/pandora/settings.py b/pandora/settings.py index 5ad456f2..7b9f7a26 100644 --- a/pandora/settings.py +++ b/pandora/settings.py @@ -183,6 +183,7 @@ ITEM_POSTER = join(SCRIPT_ROOT, 'poster') ITEM_ICON = join(SCRIPT_ROOT, 'item_icon') LIST_ICON = join(SCRIPT_ROOT, 'list_icon') +DB_GIN_TRGM = False #you can ignore things below this line #=========================================================================