discourse/db/migrate/20210601002145_rename_trust...

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

22 lines
598 B
Ruby
Raw Permalink Normal View History

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