mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 09:44:34 +08:00
30990006a9
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
23 lines
526 B
Ruby
23 lines
526 B
Ruby
# frozen_string_literal: true
|
|
|
|
class RenameTrustLevelBadges < ActiveRecord::Migration[4.2]
|
|
|
|
def rename(id, old, new)
|
|
execute "UPDATE badges SET name = '#{new}' WHERE name = '#{old}' AND id = #{id}"
|
|
rescue
|
|
puts "#{new} badge is already in use, skipping rename"
|
|
end
|
|
|
|
def up
|
|
rename 2, 'Regular User', 'Member'
|
|
rename 3, 'Leader', 'Regular'
|
|
rename 4, 'Elder', 'Leader'
|
|
end
|
|
|
|
def down
|
|
rename 2, 'Member', 'Regular User'
|
|
rename 3, 'Regular', 'Leader'
|
|
rename 4, 'Leader', 'Elder'
|
|
end
|
|
end
|