discourse/db/migrate/20190430135846_migrate_english_locale.rb
Gerhard Schlager b788948985 FEATURE: English locale with international date formats
Makes en_US the new default locale
2019-05-20 13:47:20 +02:00

56 lines
1.0 KiB
Ruby

# frozen_string_literal: true
class MigrateEnglishLocale < ActiveRecord::Migration[5.2]
def up
execute <<~SQL
UPDATE users
SET locale = 'en_US'
WHERE locale = 'en'
SQL
execute <<~SQL
UPDATE site_settings
SET value = 'en_US'
WHERE name = 'default_locale' AND value = 'en'
SQL
execute <<~SQL
UPDATE translation_overrides
SET locale = 'en_US'
WHERE locale = 'en'
SQL
execute <<~SQL
UPDATE theme_translation_overrides
SET locale = 'en_US'
WHERE locale = 'en'
SQL
end
def down
execute <<~SQL
UPDATE users
SET locale = 'en'
WHERE locale = 'en_US'
SQL
execute <<~SQL
UPDATE site_settings
SET value = 'en'
WHERE name = 'default_locale' AND value = 'en_US'
SQL
execute <<~SQL
UPDATE translation_overrides
SET locale = 'en'
WHERE locale = 'en_US'
SQL
execute <<~SQL
UPDATE theme_translation_overrides
SET locale = 'en'
WHERE locale = 'en_US'
SQL
end
end