DEV: Fix incorrectly hardcoded value in rake task.

DEV: Fix incorrectly hardcoded value in rake task.

diff --git a/lib/tasks/uploads.rake b/lib/tasks/uploads.rake
index f32bf80..54508fa 100644
--- a/lib/tasks/uploads.rake
+++ b/lib/tasks/uploads.rake
@@ -229,7 +229,7 @@ def migration_successful?(db, should_raise = false)
   prefix = ENV["MIGRATE_TO_MULTISITE"] ? "uploads/#{db}/original/" : "original/"
 
   base_url = File.join(SiteSetting.Upload.s3_base_url, prefix)
-  count = Upload.where("id >= 0 AND url NOT LIKE '#{base_url}%'").count
+  count = Upload.by_users.where("url NOT LIKE '#{base_url}%'").count
   raise "#{count} of #{Upload.count} uploads are not migrated to S3. #{failure_message}" if count > 0 && should_raise
   success &&= count == 0

GitHub sha: 5429c9b5

2 Likes

Hmmm why was this hardcoded to >= 0 initially ?

Whoever that wrote it probably didn’t know about Upload.by_users

2 Likes