+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
require 'has_uuid'
require 'kind_and_etag'
-class FixCollectionPortableDataHashWithHintedManifest < ActiveRecord::Migration
+class FixCollectionPortableDataHashWithHintedManifest < ActiveRecord::Migration[4.2]
include CurrentApiClient
class ArvadosModel < ActiveRecord::Base
end
def each_bad_collection
+ end_coll = Collection.order("id DESC").first
+ return if end_coll.nil?
seen_uuids = []
("A".."Z").each do |hint_char|
- query = Collection.where("manifest_text LIKE '%+#{hint_char}%'")
+ query = Collection.
+ where("id <= ? AND manifest_text LIKE '%+#{hint_char}%'", end_coll.id)
unless seen_uuids.empty?
query = query.where("uuid NOT IN (?)", seen_uuids)
end