discourse/db/migrate/20210601002145_rename_trust...

26 lines
624 B
Ruby

# frozen_string_literal: true
class RenameTrustLevelTranslations < ActiveRecord::Migration[6.1]
KEYS = %w[newuser basic member regular leader]
def up
KEYS.each do |key|
execute <<~SQL
UPDATE translation_overrides
SET translation_key = 'js.trust_levels.names.#{key}'
WHERE translation_key = 'trust_levels.#{key}.title'
SQL
end
end
def down
KEYS.each do |key|
execute <<~SQL
UPDATE translation_overrides
SET translation_key = 'trust_levels.#{key}.title'
WHERE translation_key = 'js.trust_levels.names.#{key}'
SQL
end
end
end