Skip to content

`lib/gitlab/database/partitioning/` should work with many databases

Currently our partitioning is a hand written generation of different SQL queries executed on top of ActiveRecord::Base.connection. We should adapt that to properly support many databases, and make it to use a connection of an associated model for which partitions are to be created.

Ref.:

  1. The first issue is that partitioned tables fail to create on the ci: database (config/initializers/postgres_partitioning.rb). This is tricky because only the audit_event structure exists on the ci: database but the AuditEvent model don't ever have a connection to that ci: database.
    1. Note: Partitioning creation/sync seems to work locally for some reason. We should investigate why
Edited by Thong Kuah