diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-01-08 14:31:39 +0100 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-01-08 14:31:39 +0100 |
commit | 8d7a968d6dbc70d31953bac5262c86c4ca9dc7d9 (patch) | |
tree | 4950a0162fefed74561f74348d093c1e37be4bb3 | |
parent | 61561a9eeb1dbb8273a1e8c8a5f37c0c01917c99 (diff) | |
download | gitlab-ce-8d7a968d6dbc70d31953bac5262c86c4ca9dc7d9.tar.gz |
Handle missing DBs in connect_to_db?
This ensures CurrentSettings#connect_to_db? returns "false" in the event
of a database not existing, instead of raising an error.
-rw-r--r-- | lib/gitlab/current_settings.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/gitlab/current_settings.rb b/lib/gitlab/current_settings.rb index 7a86c09158e..7f938780ab1 100644 --- a/lib/gitlab/current_settings.rb +++ b/lib/gitlab/current_settings.rb @@ -41,6 +41,9 @@ module Gitlab use_db && ActiveRecord::Base.connection.active? && !ActiveRecord::Migrator.needs_migration? && ActiveRecord::Base.connection.table_exists?('application_settings') + + rescue ActiveRecord::NoDatabaseError + false end end end |