Ensure TestReport build association is compatible with DB decomposition
The RequirementsManagement::TestReport
model has a foreign key to the ci_builds
table, which will move to a new database as part of &6167 (closed).
We should review this and ensure that it is compatible with a Rails multi-database configuration. It may be necessary to manually implement the existing belongs_to
association.
module RequirementsManagement
class TestReport < ApplicationRecord
#... associations and scopes
# belongs_to :build, class_name: 'Ci::Build'
def build
Ci::Build.where(id: build_id).last
end
If nothing joins the ci_builds
table through test reports then there may be no action to take here, the association may work by default. If there is, the scope will need to be manually created using a method or, if we upgrade to Rails 7, the disable_joins
argument can be used.