Merge branch 'master' into 4523-search-index
[arvados.git] / services / api / db / migrate / 20141208164553_owner_uuid_index.rb
1 class OwnerUuidIndex < ActiveRecord::Migration
2   def tables_with_owner_uuid
3     %w{api_clients authorized_keys collections groups humans
4        job_tasks jobs keep_disks keep_services links logs
5        nodes pipeline_instances pipeline_templates repositories
6        specimens traits users virtual_machines}
7   end
8
9   def up
10     tables_with_owner_uuid.each do |table|
11       add_index table.to_sym, :owner_uuid
12     end
13   end
14
15   def down
16     tables_with_owner_uuid.each do |table|
17       remove_index table.to_sym, :owner_uuid
18     end
19   end
20 end