0fc9f9d3e7
DB schema generated by a migration may look different in rails 4 and 5 (because rails 5 may use different default values). For this reason it's important to explicitly set for which rails version a migration was written for. See https://stackoverflow.com/questions/35929869/activerecordmigration-deprecation-warning-asks-for-rails-version-but-im-no/35930912#35930912
15 lines
725 B
Ruby
15 lines
725 B
Ruby
# Migration type: online without errors (works on previous version and new one)
|
|
class RenameEmojis < ActiveRecord::Migration[4.2]
|
|
def up
|
|
# Renames aliases to main names
|
|
execute("UPDATE notes SET note ='thumbsup' WHERE is_award = true AND note = '+1'")
|
|
execute("UPDATE notes SET note ='thumbsdown' WHERE is_award = true AND note = '-1'")
|
|
execute("UPDATE notes SET note ='poop' WHERE is_award = true AND note = 'shit'")
|
|
end
|
|
|
|
def down
|
|
execute("UPDATE notes SET note ='+1' WHERE is_award = true AND note = 'thumbsup'")
|
|
execute("UPDATE notes SET note ='-1' WHERE is_award = true AND note = 'thumbsdown'")
|
|
execute("UPDATE notes SET note ='shit' WHERE is_award = true AND note = 'poop'")
|
|
end
|
|
end
|