Commit 7d8d67bc authored by Marko Kuder's avatar Marko Kuder
Browse files

migrate idx_package_extra_package_period for faster revision retrieval

parent 359902fd
......@@ -2,6 +2,7 @@
import logging
from ckan.lib.cli import CkanCommand
from ckan.model.meta import metadata, mapper, Session
class Migrate(CkanCommand):
"""
......@@ -20,7 +21,22 @@ class Migrate(CkanCommand):
self._load_config()
log = logging.getLogger(__name__)
self.migrate_v2_10()
self.migrate_v2_20()
def migrate_v2_10(self):
from ckanext.dgu.model.package_likes import migrate_v2_10 as migrate_likes
migrate_likes()
\ No newline at end of file
migrate_likes()
def migrate_v2_20(self):
log = logging.getLogger(__name__)
#create additional index to aid optimized revision retrieval which is slower when ordering by revision_timestamp
log.info('Migrating v2.20 - adding index for package_extra with better column ordering')
conn = Session.connection()
statements = '''
CREATE INDEX idx_package_extra_package_period on package_extra_revision(package_id, revision_timestamp, expired_timestamp);
'''
conn.execute(statements)
Session.commit()
log.info('Migrated to v2.20')
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment