X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/840592d4a4e02072c982aeaeab5b38daecfcd840..50be38a022fe282c55703c9e3903b0400eaa20fb:/services/api/db/migrate/20141208174653_collection_file_names.rb diff --git a/services/api/db/migrate/20141208174653_collection_file_names.rb b/services/api/db/migrate/20141208174653_collection_file_names.rb index 8b182e9025..0aeb3d4ac1 100644 --- a/services/api/db/migrate/20141208174653_collection_file_names.rb +++ b/services/api/db/migrate/20141208174653_collection_file_names.rb @@ -1,5 +1,20 @@ class CollectionFileNames < ActiveRecord::Migration - def change - add_column :collections, :file_names, :string, :limit => 2**16 + include CurrentApiClient + + def up + add_column :collections, :file_names, :string, :limit => 2**13 + + act_as_system_user do + Collection.find_each(batch_size: 20) do |c| + file_names = c.manifest_files + ActiveRecord::Base.connection.execute "UPDATE collections + SET file_names = #{ActiveRecord::Base.connection.quote(file_names)} + WHERE uuid = '#{c.uuid}'" + end + end + end + + def down + remove_column :collections, :file_names end end