diff options
author | Marin Jankovski <maxlazio@gmail.com> | 2015-01-14 09:03:25 +0100 |
---|---|---|
committer | Marin Jankovski <maxlazio@gmail.com> | 2015-01-14 09:03:25 +0100 |
commit | e348af1d4c29f2aa7fb03a7910fd816850caab11 (patch) | |
tree | 982bb9adab7a79eea380d93be53eec5ee7274e5e /lib | |
parent | 01ab08125982b7c786818ffdd608e6169d0ff43d (diff) | |
download | gitlab-ce-e348af1d4c29f2aa7fb03a7910fd816850caab11.tar.gz |
Rescue database error in application settings if the database still doesn't exist.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/current_settings.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/gitlab/current_settings.rb b/lib/gitlab/current_settings.rb index 5d88a601dea..22ad7ef8c8b 100644 --- a/lib/gitlab/current_settings.rb +++ b/lib/gitlab/current_settings.rb @@ -8,7 +8,7 @@ module Gitlab else fake_application_settings end - rescue ActiveRecord::NoDatabaseError + rescue ActiveRecord::NoDatabaseError, database_adapter.constantize::Error fake_application_settings end end @@ -22,5 +22,16 @@ module Gitlab sign_in_text: Settings.extra['sign_in_text'], ) end + + # We need to check which database is setup + # but we cannot assume that the database exists already. + # Not checking this will break "rake gitlab:setup". + def database_adapter + if Rails.configuration.database_configuration[Rails.env]['adapter'] == 'mysql2' + "Mysql2" + else + "PG" + end + end end end |