19961: Merge branch 'main'
[arvados.git] / services / api / db / migrate / 20150123142953_full_text_search.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 class FullTextSearch < ActiveRecord::Migration[4.2]
6
7   def up
8     execute "CREATE INDEX collections_full_text_search_idx ON collections USING gin(#{Collection.full_text_tsvector});"
9     execute "CREATE INDEX groups_full_text_search_idx ON groups USING gin(#{Group.full_text_tsvector});"
10     execute "CREATE INDEX jobs_full_text_search_idx ON jobs USING gin(#{Job.full_text_tsvector});"
11     execute "CREATE INDEX pipeline_instances_full_text_search_idx ON pipeline_instances USING gin(#{PipelineInstance.full_text_tsvector});"
12     execute "CREATE INDEX pipeline_templates_full_text_search_idx ON pipeline_templates USING gin(#{PipelineTemplate.full_text_tsvector});"
13   end
14
15   def down
16     remove_index :pipeline_templates, :name => 'pipeline_templates_full_text_search_idx'
17     remove_index :pipeline_instances, :name => 'pipeline_instances_full_text_search_idx'
18     remove_index :jobs, :name => 'jobs_full_text_search_idx'
19     remove_index :groups, :name => 'groups_full_text_search_idx'
20     remove_index :collections, :name => 'collections_full_text_search_idx'
21   end
22 end