From 667b98017aa08172b27f95103e560c9e90f9e7c2 Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Fri, 14 Jun 2019 09:39:09 +1000 Subject: [PATCH] FIX: do not attempt to migrate pre-existing uploads This makes this job re-runnable just in case cause it will skip creation of new uploads if an upload already exists --- app/jobs/onceoff/migrate_url_site_settings.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/jobs/onceoff/migrate_url_site_settings.rb b/app/jobs/onceoff/migrate_url_site_settings.rb index 63df91a50fd..4ddb2f3270c 100644 --- a/app/jobs/onceoff/migrate_url_site_settings.rb +++ b/app/jobs/onceoff/migrate_url_site_settings.rb @@ -17,6 +17,12 @@ module Jobs def execute_onceoff(args) SETTINGS.each do |old_setting, new_setting| + + if upload_id = SiteSetting.get(new_setting) + logger.warn("Skipping migration of the Site Setting #{new_setting} to url cause upload #{upload_id} already exists for it") + next + end + old_url = DB.query_single( "SELECT value FROM site_settings WHERE name = '#{old_setting}'" ).first