Skip to content

A platform for community discussion. Free, open, simple.

Disable migrate_to_new_scheme once there is nothing to migrate.

Guo Xiang Tan573ddcbbd014
diff --git a/app/models/upload.rb b/app/models/upload.rb
index 5c711a7c511..303f192465a 100644
--- a/app/models/upload.rb
+++ b/app/models/upload.rb
@@ -212,6 +212,12 @@ class Upload < ActiveRecord::Base
scope = Upload.by_users.where("url NOT LIKE '%/original/_X/%' AND url LIKE '%/uploads/#{RailsMultisite::ConnectionManagement.current_db}%'").order(id: :desc)
scope = scope.limit(limit) if limit
+
+ if scope.count == 0
+ SiteSetting.migrate_to_new_scheme = false
+ return problems
+ end
+
remap_scope = nil
scope.each do |upload|