8784: Fix test for latest firefox.
[arvados.git] / services / api / db / migrate / 20141208174653_collection_file_names.rb
1 class CollectionFileNames < ActiveRecord::Migration
2   include CurrentApiClient
3
4   def up
5     add_column :collections, :file_names, :string, :limit => 2**13
6
7     act_as_system_user do
8       Collection.find_each(batch_size: 20) do |c|
9         file_names = c.manifest_files
10         ActiveRecord::Base.connection.execute "UPDATE collections
11                     SET file_names = #{ActiveRecord::Base.connection.quote(file_names)}
12                     WHERE uuid = '#{c.uuid}'"
13       end
14     end
15   end
16
17   def down
18     remove_column :collections, :file_names
19   end
20 end