Add ENV to skip multisite prefix when migrating to s3.

Add ENV to skip multisite prefix when migrating to s3.

diff --git a/lib/tasks/uploads.rake b/lib/tasks/uploads.rake
index 05105f5..4783faa 100644
--- a/lib/tasks/uploads.rake
+++ b/lib/tasks/uploads.rake
@@ -271,7 +271,14 @@ def migrate_to_s3
   print " - Listing S3 files"
 
   s3_objects = []
-  prefix = Rails.configuration.multisite ? "#{db}/original/" : "original/"
+
+  prefix =
+    if ENV["SKIP_MULTISITE_PREFIX"] || Rails.configuration.multisite
+      "uploads/#{db}/original/"
+    else
+      "original/"
+    end
+
   options = { bucket: bucket, prefix: folder + prefix }
 
   loop do

GitHub sha: 07850994

Commit message can be a bit better here (though we can not fix in retrospect).

I take it this in place @tgxworld for “old” multisites configured with S3. So we have a slightly easier path moving to the more sane storage pattern.

1 Like