-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"],
}
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