Commit cec341d1 authored by dfrazao-gitlab's avatar dfrazao-gitlab Committed by Thong Kuah

Fix `SchemaCacheWithRenamedTable` does not work with many databases

Instead of getting the connection from ActiveRecord::Base,
we use the connection from ActiveRecord::ConnectionAdapters::SchemaCache.
Schema cache will return the proper connection based on the database context.

Related to https://gitlab.com/gitlab-org/gitlab/-/issues/336899
parent 75e4516c
......@@ -42,7 +42,7 @@ module Gitlab
def renamed_tables_cache
@renamed_tables ||= begin
Gitlab::Database::TABLES_TO_BE_RENAMED.select do |old_name, new_name|
ActiveRecord::Base.connection.view_exists?(old_name)
connection.view_exists?(old_name)
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