summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2018-11-26 17:14:05 -0200
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2018-11-26 17:14:05 -0200
commit5f8423dd858639ab34222a9043b534b2d2b53cad (patch)
tree576208326b261da02d3a9685740eb570bc8750bc /lib
parent4ec90095028b7519f64d209a9358831508dbf77f (diff)
downloadgitlab-ce-5f8423dd858639ab34222a9043b534b2d2b53cad.tar.gz
CE port of 'Move EE specific code from Gitbab::Database into ee'
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/database.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/gitlab/database.rb b/lib/gitlab/database.rb
index 68ed53cf64a..6d40e00c035 100644
--- a/lib/gitlab/database.rb
+++ b/lib/gitlab/database.rb
@@ -35,7 +35,6 @@ module Gitlab
adapter_name.casecmp('postgresql').zero?
end
- # Overridden in EE
def self.read_only?
false
end
@@ -44,12 +43,14 @@ module Gitlab
!self.read_only?
end
- # check whether the underlying database is in read-only mode
+ # Check whether the underlying database is in read-only mode
def self.db_read_only?
if postgresql?
- ActiveRecord::Base.connection.execute('SELECT pg_is_in_recovery()')
- .first
- .fetch('pg_is_in_recovery') == 't'
+ pg_is_in_recovery =
+ ActiveRecord::Base.connection.execute('SELECT pg_is_in_recovery()')
+ .first.fetch('pg_is_in_recovery')
+
+ Gitlab::Utils.to_boolean(pg_is_in_recovery)
else
false
end