Patch Rails 7 for CI partitioning
What does this MR do and why?
Related to #377521 (closed) and #377940 (closed)
It will allow us to cascade the partition_id
filter through scoped associations and joins. This is the minimal and least invasive patch that I could think of and would not block us from switching to Rails native solution down the line.
Usage
class Job < ApplicationRecord
belongs_to :pipeline,
-> (build) { where(partition_id: build.partition_id) },
partition_foreign_key: :partition_id # used for the join filter
# To control the join filter
def self.use_partition_id_filter?
Feature.enabled?(...)
end
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Marius Bobin