diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-12 06:12:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-12 06:12:11 +0300 |
commit | f78f3d867871ce9ad79e5fcb8e4e3e8ffda37200 (patch) | |
tree | 5970d9f84231a66d2bb040fa50ce820b0d5de520 /app/models/packages | |
parent | 5e13b3a9e58a7b78e93b4aa5a12cc19bd6bca674 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/packages')
-rw-r--r-- | app/models/packages/package.rb | 10 | ||||
-rw-r--r-- | app/models/packages/package_file.rb | 2 |
2 files changed, 3 insertions, 9 deletions
diff --git a/app/models/packages/package.rb b/app/models/packages/package.rb index f25d0299524..962a1057a22 100644 --- a/app/models/packages/package.rb +++ b/app/models/packages/package.rb @@ -41,7 +41,7 @@ class Packages::Package < ApplicationRecord has_one :rubygems_metadatum, inverse_of: :package, class_name: 'Packages::Rubygems::Metadatum' has_one :npm_metadatum, inverse_of: :package, class_name: 'Packages::Npm::Metadatum' has_many :build_infos, inverse_of: :package - has_many :pipelines, through: :build_infos, disable_joins: -> { disable_cross_joins_to_pipelines? } + has_many :pipelines, through: :build_infos, disable_joins: true has_one :debian_publication, inverse_of: :package, class_name: 'Packages::Debian::Publication' has_one :debian_distribution, through: :debian_publication, source: :distribution, inverse_of: :packages, class_name: 'Packages::Debian::ProjectDistribution' @@ -103,7 +103,6 @@ class Packages::Package < ApplicationRecord scope :with_status, ->(status) { where(status: status) } scope :displayable, -> { with_status(DISPLAYABLE_STATUSES) } scope :installable, -> { with_status(INSTALLABLE_STATUSES) } - scope :including_build_info, -> { includes(pipelines: :user) } scope :including_project_route, -> { includes(project: { namespace: :route }) } scope :including_tags, -> { includes(:tags) } scope :including_dependency_links, -> { includes(dependency_links: :dependency) } @@ -137,7 +136,6 @@ class Packages::Package < ApplicationRecord scope :last_of_each_version, -> { where(id: all.select('MAX(id) AS id').group(:version)) } scope :limit_recent, ->(limit) { order_created_desc.limit(limit) } scope :select_distinct_name, -> { select(:name).distinct } - scope :load_pipelines, -> { disable_cross_joins_to_pipelines? ? preload_pipelines : including_build_info } # Sorting scope :order_created, -> { reorder(created_at: :asc) } @@ -164,10 +162,6 @@ class Packages::Package < ApplicationRecord joins(:project).reorder(keyset_order) end - def self.disable_cross_joins_to_pipelines? - ::Feature.enabled?(:packages_remove_cross_joins_to_pipelines, default_enabled: :yaml) - end - def self.only_maven_packages_with_path(path, use_cte: false) if use_cte # This is an optimization fence which assumes that looking up the Metadatum record by path (globally) @@ -253,7 +247,7 @@ class Packages::Package < ApplicationRecord def versions project.packages - .load_pipelines + .preload_pipelines .including_tags .with_name(name) .where.not(version: version) diff --git a/app/models/packages/package_file.rb b/app/models/packages/package_file.rb index 554c5e64f7c..87c9f56cc41 100644 --- a/app/models/packages/package_file.rb +++ b/app/models/packages/package_file.rb @@ -15,7 +15,7 @@ class Packages::PackageFile < ApplicationRecord has_one :conan_file_metadatum, inverse_of: :package_file, class_name: 'Packages::Conan::FileMetadatum' has_many :package_file_build_infos, inverse_of: :package_file, class_name: 'Packages::PackageFileBuildInfo' - has_many :pipelines, through: :package_file_build_infos, disable_joins: -> { Packages::Package.disable_cross_joins_to_pipelines? } + has_many :pipelines, through: :package_file_build_infos, disable_joins: true has_one :debian_file_metadatum, inverse_of: :package_file, class_name: 'Packages::Debian::FileMetadatum' has_one :helm_file_metadatum, inverse_of: :package_file, class_name: 'Packages::Helm::FileMetadatum' |