5276: Merge branch 'master' into 5276-job-graph-phantom-tooltip
[arvados.git] / services / api / db / migrate / 20150303210106_fix_collection_portable_data_hash_with_hinted_manifest.rb
index 9bbe113562d7659800023745e3f62b241c53c383..ee6865fbf020873e7edd7ec7297bbbfc3a8089b7 100644 (file)
@@ -55,9 +55,12 @@ class FixCollectionPortableDataHashWithHintedManifest < ActiveRecord::Migration
   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