Commit 3bf9b660 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'rescue_database_error' into 'master'

Rescue database error

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 for packaging as we need to do asset precompile before the database exists.

See merge request !1393
parents 9920ede2 e348af1d
...@@ -8,7 +8,7 @@ module Gitlab ...@@ -8,7 +8,7 @@ module Gitlab
else else
fake_application_settings fake_application_settings
end end
rescue ActiveRecord::NoDatabaseError rescue ActiveRecord::NoDatabaseError, database_adapter.constantize::Error
fake_application_settings fake_application_settings
end end
end end
...@@ -22,5 +22,16 @@ module Gitlab ...@@ -22,5 +22,16 @@ module Gitlab
sign_in_text: Settings.extra['sign_in_text'], sign_in_text: Settings.extra['sign_in_text'],
) )
end 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
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment