X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/ec7cd27f399097d76822eb05867102e2b7d19be7..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 51b474612d..50ab30c39a 100644 --- a/services/api/db/migrate/20141208174653_collection_file_names.rb +++ b/services/api/db/migrate/20141208174653_collection_file_names.rb @@ -1,3 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + class CollectionFileNames < ActiveRecord::Migration include CurrentApiClient @@ -5,11 +9,11 @@ class CollectionFileNames < ActiveRecord::Migration add_column :collections, :file_names, :string, :limit => 2**13 act_as_system_user do - Collection.all.each do |c| - if c.manifest_text - file_names = Collection.manifest_files c.manifest_text - update_sql "UPDATE collections SET file_names = '#{file_names}' WHERE uuid = '#{c.uuid}'" - end + 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