discourse/db/migrate/20160127222802_migrate_uncategorized_description_setting.rb
Sam Saffron 30990006a9 DEV: enable frozen string literal on all files
This reduces chances of errors where consumers of strings mutate inputs
and reduces memory usage of the app.

Test suite passes now, but there may be some stuff left, so we will run
a few sites on a branch prior to merging
2019-05-13 09:31:32 +08:00

14 lines
623 B
Ruby

# frozen_string_literal: true
class MigrateUncategorizedDescriptionSetting < ActiveRecord::Migration[4.2]
def change
execute "INSERT INTO translation_overrides (locale, translation_key, value, created_at, updated_at)
SELECT '#{I18n.locale}', 'category.uncategorized_description', value, created_at, updated_at
FROM site_settings
WHERE name = 'uncategorized_description'
AND value <> 'Topics that don''t need a category, or don''t fit into any other existing category.'"
execute "DELETE FROM site_settings WHERE name = 'uncategorized_description'"
end
end