8784: Fix test for latest firefox.
[arvados.git] / services / api / db / migrate / 20170105160301_add_output_name_to_cr_fts_index.rb
1 class AddOutputNameToCrFtsIndex < ActiveRecord::Migration
2   def up
3     t = "container_requests"
4     i = "container_requests_full_text_search_idx"
5     t.classify.constantize.reset_column_information
6     ActiveRecord::Base.connection.indexes(t).each do |idx|
7       if idx.name == i
8         remove_index t.to_sym, :name => i
9         break
10       end
11     end
12     # By now, container_request should have the new column "output_name" so full_text_tsvector
13     # would include it on its results
14     execute "CREATE INDEX #{i} ON #{t} USING gin(#{t.classify.constantize.full_text_tsvector});"
15   end
16
17   def down
18     t = "container_requests"
19     i = "container_requests_full_text_search_idx"
20     remove_index t.to_sym, :name => i
21   end
22 end