From 852a4d8ba616c1b8b7e6b96648f1fd239f6dd975 Mon Sep 17 00:00:00 2001 From: Andres Vazquez Date: Tue, 8 Sep 2020 09:40:58 -0300 Subject: [PATCH] Add index for harvest_object.guid --- ckanext/harvest/model/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ckanext/harvest/model/__init__.py b/ckanext/harvest/model/__init__.py index 1d62a6d..ec75bc2 100644 --- a/ckanext/harvest/model/__init__.py +++ b/ckanext/harvest/model/__init__.py @@ -88,6 +88,10 @@ def setup(): log.debug('Creating index for package') Index("package_id_idx", harvest_object_table.c.package_id).create() + if "guid_idx" not in index_names: + log.debug('Creating index for guid') + Index("guid_idx", harvest_object_table.c.guid).create() + index_names = [index['name'] for index in inspector.get_indexes("harvest_object_extra")] if "harvest_object_id_idx" not in index_names: log.debug('Creating index for harvest_object_extra') @@ -303,6 +307,7 @@ def define_harvester_tables(): Index('harvest_job_id_idx', 'harvest_job_id'), Index('harvest_source_id_idx', 'harvest_source_id'), Index('package_id_idx', 'package_id'), + Index('guid_idx', 'guid'), ) # New table