discourse/db/migrate/20140905055251_rename_trust_level_badges.rb

22 lines
539 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class RenameTrustLevelBadges < ActiveRecord::Migration[4.2]
2014-09-05 01:38:29 -05:00
def rename(id, old, new)
execute "UPDATE badges SET name = '#{new}' WHERE name = '#{old}' AND id = #{id}"
rescue StandardError
2014-09-05 01:38:29 -05:00
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"
2014-09-05 01:38:29 -05:00
end
def down
rename 2, "Member", "Regular User"
rename 3, "Regular", "Leader"
rename 4, "Leader", "Elder"
2014-09-05 01:38:29 -05:00
end
end