From 573ddcbbd014c0c91bf24871a0edc7d4f79a6152 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Wed, 24 Apr 2019 13:59:23 +0800 Subject: [PATCH] Disable migrate_to_new_scheme once there is nothing to migrate. --- app/models/upload.rb | 6 ++++++ 1 file changed, 6 insertions(+) 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|