X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/840592d4a4e02072c982aeaeab5b38daecfcd840..0eb72b526bf8bbb011551ecf019f604e17a534f1:/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..50ab30c39a 100644 --- a/services/api/db/migrate/20141208174653_collection_file_names.rb +++ b/services/api/db/migrate/20141208174653_collection_file_names.rb @@ -1,5 +1,24 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + 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