Skip to content

Commit

Permalink
FIX: do not attempt to migrate pre-existing uploads
Browse files Browse the repository at this point in the history
This makes this job re-runnable just in case cause it will skip creation
of new uploads if an upload already exists
  • Loading branch information
SamSaffron committed Jun 13, 2019
1 parent 4182d86 commit 667b980
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/jobs/onceoff/migrate_url_site_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ class MigrateUrlSiteSettings < Jobs::Onceoff

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
Expand Down

1 comment on commit 667b980

@discoursereviewbot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.