1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 class AddTrigramIndexForTextSearch < ActiveRecord::Migration[5.0]
8 "collections" => "collections_trgm_text_search_idx",
9 "container_requests" => "container_requests_trgm_text_search_idx",
10 "groups" => "groups_trgm_text_search_idx",
11 "jobs" => "jobs_trgm_text_search_idx",
12 "pipeline_instances" => "pipeline_instances_trgm_text_search_idx",
13 "pipeline_templates" => "pipeline_templates_trgm_text_search_idx",
14 "workflows" => "workflows_trgm_text_search_idx",
19 trgm_indexes.each do |model, indx|
20 execute "CREATE INDEX #{indx} ON #{model} USING gin((#{model.classify.constantize.full_text_trgm}) gin_trgm_ops)"
25 trgm_indexes.each do |_, indx|
26 execute "DROP INDEX IF EXISTS #{indx}"