From 1f9004a8f6b1e4b427621ab4549e1e632e55d537 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sun, 22 May 2016 22:20:27 +0000 Subject: Merge branch 'fix/migration-helpers-mysql-compatibility' into 'master' Fix MySQL compatibility in zero downtime migration helpers ## What does this MR do? This MR fixes MySQL for zero downtime migration helpers introduced in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3860 Closes #17711 See merge request !4239 --- lib/gitlab/database/migration_helpers.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb index 9b662d163f0..fd14234c558 100644 --- a/lib/gitlab/database/migration_helpers.rb +++ b/lib/gitlab/database/migration_helpers.rb @@ -39,7 +39,15 @@ module Gitlab def update_column_in_batches(table, column, value) quoted_table = quote_table_name(table) quoted_column = quote_column_name(column) - quoted_value = quote(value) + + ## + # Workaround for #17711 + # + # It looks like for MySQL `ActiveRecord::Base.conntection.quote(true)` + # returns correct value (1), but `ActiveRecord::Migration.new.quote` + # returns incorrect value ('true'), which causes migrations to fail. + # + quoted_value = connection.quote(value) processed = 0 total = exec_query("SELECT COUNT(*) AS count FROM #{quoted_table}"). -- cgit v1.2.1