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.
This commit is contained in:
Yorick Peterse 2016-01-08 14:31:39 +01:00
parent 61561a9eeb
commit 8d7a968d6d

View file

@ -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