summaryrefslogtreecommitdiff
path: root/db/migrate/20160416182152_convert_award_note_to_emoji_award.rb
blob: 073bbc0fc2a6407a0158e2f0dce908604908c3ae (plain)
1
2
3
4
5
6
7
8
9
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