Merge branch 'rails5-fix-db-check' into 'master'

Rails5 fix db check: connection execute returns integer instead of string

See merge request gitlab-org/gitlab-ce!19901
This commit is contained in:
Yorick Peterse 2018-06-18 12:44:44 +00:00
commit 7849fd3695
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
title: Rails5 fix connection execute return integer instead of string
merge_request: 19901
author: Jasper Maes
type: fixed

View file

@ -17,7 +17,7 @@ module Gitlab
def check def check
catch_timeout 10.seconds do catch_timeout 10.seconds do
if Gitlab::Database.postgresql? if Gitlab::Database.postgresql?
ActiveRecord::Base.connection.execute('SELECT 1 as ping')&.first&.[]('ping') ActiveRecord::Base.connection.execute('SELECT 1 as ping')&.first&.[]('ping')&.to_s
else else
ActiveRecord::Base.connection.execute('SELECT 1 as ping')&.first&.first&.to_s ActiveRecord::Base.connection.execute('SELECT 1 as ping')&.first&.first&.to_s
end end