discourse/db/migrate/20210601002145_rename_trust...

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
624 B
Ruby
Raw Normal View History

# 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