Skip to content

Use YAML file to define `gitlab_schema`

Today we use model.gitlab_schema = :gitlab_main/:gitlab_ci to indicate the affinity of table for the purpose of cross-join and cross-modification detection.

Problem

This is proving hard to maintain, because:

  1. We have models that do not inherit from ApplicationRecord
  2. We have models that are nested in Background Migrations or regular migrations that are based on ActiveRecord::Base
  3. We have models that are polymorphic
  4. We might not have all models when needed which results in acceleration tables for mapping to not be fully accurate

Proposal

  1. Add a method that allows to read gitlab_schema from YAML
  2. Make code that uses schema to read gitlab_schema from YAML
  3. Remove ActiveRecord::Base.gitlab_schema as we should only map table names to schema
  4. Remove old gitlab_schema = :gitlab_main
Edited by Peter Leitzen