DEV: Allow skipping failed migrations when running S3 migration

DEV: Allow skipping failed migrations when running S3 migration

Use the SKIP_FAILED environment variable to skip failed sites. Use with caution - make sure you go back and re-run the failed migrations afterwards.

diff --git a/lib/tasks/uploads.rake b/lib/tasks/uploads.rake
index bab68b1..6a30d23 100644
--- a/lib/tasks/uploads.rake
+++ b/lib/tasks/uploads.rake
@@ -209,7 +209,16 @@ task "uploads:migrate_to_s3" => :environment do
 end
 
 def migrate_to_s3_all_sites
-  RailsMultisite::ConnectionManagement.each_connection { migrate_to_s3 }
+  RailsMultisite::ConnectionManagement.each_connection do
+    begin
+      migrate_to_s3
+    rescue e
+      if ENV["SKIP_FAILED"]
+        puts e
+      else
+        raise e unless ENV["SKIP_FAILED"]
+      end
+  end
 end
 
 def migration_successful?(db, should_raise = false)

GitHub sha: 31902159