Skip to content

Geo: Use methods instead of constants for model class name and FK name in SSF model registry classes

As recommended in the code review here, we want registry classes to use methods instead of constants, to make changing of replicable models possible on the fly:

question (non-blocking): WDYT about trying to avoid complexity by replacing usages of MODEL_CLASS and MODEL_FOREIGN_KEY with methods model_class and model_foreign_key in a refactor prior to this MR?

That would allow this MR to define in this registry class:

def model_class
  ::Feature.enabled?(:geo_project_repository_replication_v2) ? ::ProjectRepository : ::Project
end

def model_foreign_key
  ::Feature.enabled?(:geo_project_repository_replication_v2) ? :project_repository_id : :project_id
end

Are these constants called prior to Rails initialization?

Edited by 🤖 GitLab Bot 🤖