Commit c6744b49 authored by Yorick Peterse's avatar Yorick Peterse

Fixed locking syntax for PostgreSQL

parent d032c6b0
...@@ -19,7 +19,7 @@ class ConvertAwardNoteToEmojiAward < ActiveRecord::Migration ...@@ -19,7 +19,7 @@ class ConvertAwardNoteToEmojiAward < ActiveRecord::Migration
def migrate_postgresql def migrate_postgresql
connection.transaction do connection.transaction do
execute 'LOCK notes IN EXCLUSIVE' execute 'LOCK notes IN EXCLUSIVE MODE'
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 "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" execute "DELETE FROM notes WHERE is_award = true"
remove_column :notes, :is_award, :boolean remove_column :notes, :is_award, :boolean
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment