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.
This commit is contained in:
David Taylor 2019-05-20 17:25:56 +01:00
parent a15cca9a0f
commit 31902159af
1 changed files with 10 additions and 1 deletions

View File

@ -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)