X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/ce4285dd9a6310a799b861237918273329390316..HEAD:/services/api/db/migrate/20180917205609_recompute_file_names_index.rb diff --git a/services/api/db/migrate/20180917205609_recompute_file_names_index.rb b/services/api/db/migrate/20180917205609_recompute_file_names_index.rb index 3dbc0ec3df..ed6be3bfe1 100644 --- a/services/api/db/migrate/20180917205609_recompute_file_names_index.rb +++ b/services/api/db/migrate/20180917205609_recompute_file_names_index.rb @@ -1,10 +1,14 @@ -class RecomputeFileNamesIndex < ActiveRecord::Migration +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + +class RecomputeFileNamesIndex < ActiveRecord::Migration[4.2] def do_batch(pdhs:) ActiveRecord::Base.connection.exec_query('BEGIN') Collection.select(:portable_data_hash, :manifest_text).where(portable_data_hash: pdhs).distinct(:portable_data_hash).each do |c| ActiveRecord::Base.connection.exec_query("update collections set file_names=$1 where portable_data_hash=$2", "update file_names index", - [[nil, c.manifest_files], [nil, c.portable_data_hash]]) + [c.manifest_files, c.portable_data_hash]) end ActiveRecord::Base.connection.exec_query('COMMIT') end