diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-06 21:15:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-06 21:15:59 +0300 |
commit | 8c7cea621c8ce2caf4a211d09aa60b2a125652cb (patch) | |
tree | afbedbbf1fedadac80c7b231748841e4f2484e3d /app/models/packages | |
parent | eb4c4ae6212b8f305af700a18d60548ef17e047c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/packages')
-rw-r--r-- | app/models/packages/package.rb | 2 | ||||
-rw-r--r-- | app/models/packages/package_file.rb | 21 |
2 files changed, 9 insertions, 14 deletions
diff --git a/app/models/packages/package.rb b/app/models/packages/package.rb index 1b2c3e25283..ca0ffc19019 100644 --- a/app/models/packages/package.rb +++ b/app/models/packages/package.rb @@ -133,7 +133,7 @@ class Packages::Package < ApplicationRecord scope :without_nuget_temporary_name, -> { where.not(name: Packages::Nuget::TEMPORARY_PACKAGE_NAME) } scope :has_version, -> { where.not(version: nil) } - scope :preload_files, -> { Feature.enabled?(:packages_installable_package_files, default_enabled: :yaml) ? preload(:installable_package_files) : preload(:package_files) } + scope :preload_files, -> { preload(:installable_package_files) } scope :preload_pipelines, -> { preload(pipelines: :user) } scope :last_of_each_version, -> { where(id: all.select('MAX(id) AS id').group(:version)) } scope :limit_recent, ->(limit) { order_created_desc.limit(limit) } diff --git a/app/models/packages/package_file.rb b/app/models/packages/package_file.rb index 190081c4e8e..fc7c348dfdb 100644 --- a/app/models/packages/package_file.rb +++ b/app/models/packages/package_file.rb @@ -55,12 +55,11 @@ class Packages::PackageFile < ApplicationRecord end scope :for_helm_with_channel, ->(project, channel) do - result = joins(:package) - .merge(project.packages.helm.installable) - .joins(:helm_file_metadatum) - .where(packages_helm_file_metadata: { channel: channel }) - result = result.installable if Feature.enabled?(:packages_installable_package_files, default_enabled: :yaml) - result + joins(:package) + .merge(project.packages.helm.installable) + .joins(:helm_file_metadatum) + .where(packages_helm_file_metadata: { channel: channel }) + .installable end scope :with_conan_file_type, ->(file_type) do @@ -110,13 +109,9 @@ class Packages::PackageFile < ApplicationRecord cte_name = :packages_cte cte = Gitlab::SQL::CTE.new(cte_name, packages.select(:id)) - package_files = if Feature.enabled?(:packages_installable_package_files, default_enabled: :yaml) - ::Packages::PackageFile.installable.limit_recent(1) - .where(arel_table[:package_id].eq(Arel.sql("#{cte_name}.id"))) - else - ::Packages::PackageFile.limit_recent(1) - .where(arel_table[:package_id].eq(Arel.sql("#{cte_name}.id"))) - end + package_files = ::Packages::PackageFile.installable + .limit_recent(1) + .where(arel_table[:package_id].eq(Arel.sql("#{cte_name}.id"))) package_files = package_files.joins(extra_join) if extra_join package_files = package_files.where(extra_where) if extra_where |