Merge branch '20757-ctr-shell-settings'
[arvados.git] / services / api / db / migrate / 20151215134304_fix_containers_index.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 class FixContainersIndex < ActiveRecord::Migration[4.2]
6   def up
7     execute "CREATE INDEX container_requests_full_text_search_idx ON container_requests USING gin(#{ContainerRequest.full_text_tsvector});"
8     add_index :container_requests, ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "name", "state", "requesting_container_uuid", "container_uuid", "container_image", "cwd", "output_path"], name: 'container_requests_search_index'
9     add_index :containers, ["uuid", "owner_uuid", "modified_by_client_uuid", "modified_by_user_uuid", "state", "log", "cwd", "output_path", "output", "container_image"], name: 'containers_search_index'
10     add_index :container_requests, :owner_uuid
11     add_index :containers, :owner_uuid
12   end
13
14   def down
15     remove_index :container_requests, :name => 'container_requests_full_text_search_idx'
16     remove_index :container_requests, :name => 'container_requests_search_index'
17     remove_index :containers, :name => 'containers_search_index'
18     remove_index :container_requests, :owner_uuid
19     remove_index :containers, :owner_uuid
20   end
21 end