Resolve cross DB issues in app/models/vulnerability.rb

Summary

The base vulnerability model has a scope to include projects which cannot be used when the tables are decomposed.

Further details

with_projects calls includes(:project) and allow_cross_joins_across_databases.

See https://gitlab.com/gitlab-org/gitlab/-/blob/02b025571341b90fb51757da6f38c545e9dfb521/app/models/vulnerability.rb#L9

  scope :with_projects, -> { includes(:project).allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/486246') }

Proposal

Use preload instead of includes.

Edited Nov 20, 2024 by Fabien Catteau
Assignee Loading
Time tracking Loading