Merge branch '15296-cwl-cancel-procs' closes #15296
[arvados.git] / services / api / db / migrate / 20141208185217_search_index.rb
index dc50fd16a3f6338dd533dc11ffbd06b4bef12e99..abea1915facdaa9bde473798773a3a5e0f2bee7c 100644 (file)
@@ -1,10 +1,14 @@
-class SearchIndex < ActiveRecord::Migration
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+class SearchIndex < ActiveRecord::Migration[4.2]
   def tables_with_searchable_columns
     {
       "api_client_authorizations" => ["api_token", "created_by_ip_address", "last_used_by_ip_address", "default_owner_uuid"],
       "api_clients" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "name", "url_prefix"],
       "authorized_keys" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "name", "key_type", "authorized_user_uuid"],
-      "collections" => ["owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "portable_data_hash", "redundancy_confirmed_by_client_uuid", "uuid", "name", "description"],
+      "collections" => ["owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "portable_data_hash", "redundancy_confirmed_by_client_uuid", "uuid", "name", "file_names"],
       "groups" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "name", "group_class"],
       "humans" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid"],
       "job_tasks" => ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "job_uuid", "created_by_job_task_uuid"],
@@ -24,15 +28,9 @@ class SearchIndex < ActiveRecord::Migration
     }
   end
 
-  def up
-    tables_with_searchable_columns.each do |table, columns|
-      add_index(table.to_sym, columns, name: "#{table}_search_index")
-    end
-  end
-
-  def down
+  def change
     tables_with_searchable_columns.each do |table, columns|
-      remove_index(table.to_sym, name: "#{table}_search_index")
+      add_index table.to_sym, columns, name: "#{table}_search_index"
     end
   end
 end