Skip to content
Permalink
Browse files

FIX: Migrate old blank override for upload site settings.

If the depercated SiteSetting.logo_url was set to "" previously, it will
not have been migrated by the onceoff job which we added. As such, we
need a migration to migrate the blank override so that the default for
certain upload site settings will not be used.
  • Loading branch information...
tgxworld committed Mar 15, 2019
1 parent 819d4fa commit 1981add261aacc279c26f5e684ae4a080607e73f
Showing with 40 additions and 0 deletions.
  1. +40 −0 db/migrate/20190315025804_migrate_blank_override_for_upload_site_settings.rb
@@ -0,0 +1,40 @@
class MigrateBlankOverrideForUploadSiteSettings < ActiveRecord::Migration[5.2]
def up
{
'logo_url' => 'logo',
'logo_small_url' => 'logo_small',
'digest_logo_url' => 'digest_logo',
'mobile_logo_url' => 'mobile_logo',
'large_icon_url' => 'large_icon',
'favicon_url' => 'favicon',
'apple_touch_icon_url' => 'apple_touch_icon',
'default_opengraph_image_url' => 'opengraph_image',
'twitter_summary_large_image_url' => 'twitter_summary_large_image',
'push_notifications_icon_url' => 'push_notifications_icon'
}.each do |old_name, new_name|
if DB.query_single("SELECT 1 FROM site_settings WHERE name = '#{old_name}' AND value = ''").present? &&
DB.query_single("SELECT 1 FROM site_settings WHERE name = '#{new_name}'").empty?

ActiveRecord::Base.connection.execute <<~SQL
INSERT INTO site_settings (
name,
data_type,
value,
created_at,
updated_at
) VALUES (
'#{new_name}',
18,
'',
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP
)
SQL
end
end
end

def down
raise ActiveRecord::IrreversibleMigration
end
end

3 comments on commit 1981add

@discoursebot

This comment has been minimized.

Copy link

discoursebot replied Mar 15, 2019

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/upgrading-from-476d005-to-bd5685c-added-logo-back/111624/4

@discoursebot

This comment has been minimized.

Copy link

discoursebot replied Mar 15, 2019

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/site-title-no-longer-supported-as-site-logo/111553/6

Please sign in to comment.
You can’t perform that action at this time.