summaryrefslogtreecommitdiff
path: root/db/migrate/20160416182152_convert_award_note_to_emoji_award.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20160416182152_convert_award_note_to_emoji_award.rb')
-rw-r--r--db/migrate/20160416182152_convert_award_note_to_emoji_award.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/db/migrate/20160416182152_convert_award_note_to_emoji_award.rb b/db/migrate/20160416182152_convert_award_note_to_emoji_award.rb
new file mode 100644
index 00000000000..c226bc11f6c
--- /dev/null
+++ b/db/migrate/20160416182152_convert_award_note_to_emoji_award.rb
@@ -0,0 +1,10 @@
+# rubocop:disable all
+class ConvertAwardNoteToEmojiAward < ActiveRecord::Migration
+ def change
+ def up
+ execute "INSERT INTO award_emoji (awardable_type, awardable_id, user_id, name, created_at, updated_at) (SELECT noteable_type, noteable_id, author_id, note, created_at, updated_at FROM notes WHERE is_award = true)"
+
+ execute "DELETE FROM notes WHERE is_award = true"
+ end
+ end
+end