From b6de0d28303a12c76847f1137e672aa60ae174ac Mon Sep 17 00:00:00 2001 From: Valery Sizov Date: Thu, 24 Dec 2015 11:28:51 +0200 Subject: Emoji picker: better alias handling --- db/migrate/20151224123230_rename_emojis.rb | 15 +++++++++++++++ db/schema.rb | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20151224123230_rename_emojis.rb (limited to 'db') diff --git a/db/migrate/20151224123230_rename_emojis.rb b/db/migrate/20151224123230_rename_emojis.rb new file mode 100644 index 00000000000..62d921dfdcc --- /dev/null +++ b/db/migrate/20151224123230_rename_emojis.rb @@ -0,0 +1,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 diff --git a/db/schema.rb b/db/schema.rb index 60b42f7a473..0d53105b057 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20151210125932) do +ActiveRecord::Schema.define(version: 20151224123230) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" -- cgit v1.2.3