Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20151224123230_rename_emojis.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 62d921dfdcce3e26b7efd0afd2a3dd192bddeead (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Migration type: online without errors (works on previous version and new one)
class RenameEmojis < ActiveRecord::Migration
  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