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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-06-13 15:15:11 +0300
committerYorick Peterse <yorickpeterse@gmail.com>2016-06-14 13:19:38 +0300
commitd032c6b0ff77a9a7568e1be8c728e252ddc1b11a (patch)
treeaf3efe2ded559e0acd33d8356bef77dffee9d50d /db
parentfc5b3a8fa51a4cbc116cc7e702602dd03cb726e1 (diff)
Move LOCK TABLES to a separate execute
MySQL apparently doesn't support executing multiple queries in the same `execute` call so we have to use a separate one for the "LOCK TABLES" statement.
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20160416182152_convert_award_note_to_emoji_award.rb7
1 files changed, 2 insertions, 5 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
index 3906ab79398..6d57b796151 100644
--- a/db/migrate/20160416182152_convert_award_note_to_emoji_award.rb
+++ b/db/migrate/20160416182152_convert_award_note_to_emoji_award.rb
@@ -27,11 +27,8 @@ class ConvertAwardNoteToEmojiAward < ActiveRecord::Migration
end
def migrate_mysql
- execute <<-EOF
- lock tables notes WRITE, award_emoji WRITE;
- 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);
- EOF
-
+ execute 'LOCK TABLES notes WRITE, award_emoji WRITE;'
+ 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"
remove_column :notes, :is_award, :boolean
ensure