Commit 507fbcc0 authored by Kamil Trzciński's avatar Kamil Trzciński

Make `db.rake` to force connection establish

This is due to bug in `rails` related to `:load_schema` task
which in some circumstances does not reconnect to previous database
when many connections are in use.
parent 409f9aa6
......@@ -151,6 +151,12 @@ namespace :gitlab do
# initializers here as the application can continue to run while
# a rake task reloads the database schema.
Rake::Task['db:test:load'].enhance do
# Due to bug in `db:test:load` if many DBs are used
# the `ActiveRecord::Base.connection` might be switched to another one
# This is due to `if should_reconnect`:
# https://github.com/rails/rails/blob/a81aeb63a007ede2fe606c50539417dada9030c7/activerecord/lib/active_record/railties/databases.rake#L622
ActiveRecord::Base.establish_connection :main
Rake::Task['gitlab:db:create_dynamic_partitions'].invoke
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