From bc95576e2cbbd2def7a6fce1bde2d0263a3d7da1 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Fri, 9 Jan 2015 11:26:26 +0100 Subject: Rescue missing database errors While loading the Rails app we cannot assume that the gitlabhq_xxx database exists already. If we do, `rake gitlab:setup` breaks! This is a quick hack to make sure that fresh development setups of GitLab (from master) will work again. --- lib/gitlab/current_settings.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/gitlab/current_settings.rb b/lib/gitlab/current_settings.rb index f3b9dcacdee..5d88a601dea 100644 --- a/lib/gitlab/current_settings.rb +++ b/lib/gitlab/current_settings.rb @@ -1,10 +1,14 @@ module Gitlab module CurrentSettings def current_application_settings - if ActiveRecord::Base.connection.table_exists?('application_settings') - ApplicationSetting.current || - ApplicationSetting.create_from_defaults - else + begin + if ActiveRecord::Base.connection.table_exists?('application_settings') + ApplicationSetting.current || + ApplicationSetting.create_from_defaults + else + fake_application_settings + end + rescue ActiveRecord::NoDatabaseError fake_application_settings end end -- cgit v1.2.1