summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-03-22 03:56:01 +0000
committerStan Hu <stanhu@gmail.com>2019-03-22 03:56:01 +0000
commit21a8079a01b791aab6f152753ad7078a6b2fd65c (patch)
tree5bcde0b4dbe57ccc3048830e2f6b195229ad8d50 /lib
parent8e3322b49cddebdc7280fee35a1d3d5985607c0b (diff)
parenta86f48c79b3d4b03279be0132e2a4eeadd5e22dc (diff)
downloadgitlab-ce-21a8079a01b791aab6f152753ad7078a6b2fd65c.tar.gz
Merge branch 'da-capitalize-db-apapter-name-on-rails-console' into 'master'
Display the database adapter name in a human-friendly way See merge request gitlab-org/gitlab-ce!26437
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/database.rb4
-rw-r--r--lib/tasks/gitlab/info.rake6
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/gitlab/database.rb b/lib/gitlab/database.rb
index e2637ad602a..8da98cc3909 100644
--- a/lib/gitlab/database.rb
+++ b/lib/gitlab/database.rb
@@ -27,6 +27,10 @@ module Gitlab
config['adapter']
end
+ def self.human_adapter_name
+ postgresql? ? 'PostgreSQL' : 'MySQL'
+ end
+
def self.mysql?
adapter_name.casecmp('mysql2').zero?
end
diff --git a/lib/tasks/gitlab/info.rake b/lib/tasks/gitlab/info.rake
index b8798fb3cfd..7872e5b08c0 100644
--- a/lib/tasks/gitlab/info.rake
+++ b/lib/tasks/gitlab/info.rake
@@ -34,9 +34,6 @@ namespace :gitlab do
puts "Sidekiq Version:#{Sidekiq::VERSION}"
puts "Go Version:\t#{go_version[1] || "unknown".color(:red)}"
- # check database adapter
- database_adapter = ActiveRecord::Base.connection.adapter_name.downcase
-
project = Group.new(path: "some-group").projects.build(path: "some-project")
# construct clone URLs
http_clone_url = project.http_url_to_repo
@@ -49,7 +46,8 @@ namespace :gitlab do
puts "Version:\t#{Gitlab::VERSION}"
puts "Revision:\t#{Gitlab.revision}"
puts "Directory:\t#{Rails.root}"
- puts "DB Adapter:\t#{database_adapter}"
+ puts "DB Adapter:\t#{Gitlab::Database.human_adapter_name}"
+ puts "DB Version:\t#{Gitlab::Database.version}"
puts "URL:\t\t#{Gitlab.config.gitlab.url}"
puts "HTTP Clone URL:\t#{http_clone_url}"
puts "SSH Clone URL:\t#{ssh_clone_url}"