Skip to content

Update Gitlab::Database::Count to support multiple databases

The module Gitlab::Database::Count provides a few strategies to get record counts from certain tables in the database. We use connection methods directly on ActiveRecord::Base in this code, rather than the connection of the passed-in model.

We appear to only count from tables which will reside on the main database, but we should make this compatible with multiple databases. This also means we should make the PgClass model (which is used in certain counting strategies) be a SharedModel and use the correct connection from the surrounding context.

Edited by Patrick Bair