Commit 0a3917de authored by Mikołaj Wawrzyniak's avatar Mikołaj Wawrzyniak

Merge branch '331306-remove-arel-package-feature-flag' into 'master'

Rollout arel_package_scopes feature [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!62614
parents 4a4b4a2f edcaa59c
......@@ -147,23 +147,15 @@ class Packages::Package < ApplicationRecord
scope :order_by_package_file, -> { joins(:package_files).order('packages_package_files.created_at ASC') }
scope :order_project_path, -> do
if Feature.enabled?(:arel_package_scopes)
keyset_order = keyset_pagination_order(join_class: Project, column_name: :path, direction: :asc)
keyset_order = keyset_pagination_order(join_class: Project, column_name: :path, direction: :asc)
joins(:project).reorder(keyset_order)
else
joins(:project).reorder('projects.path ASC, id ASC')
end
joins(:project).reorder(keyset_order)
end
scope :order_project_path_desc, -> do
if Feature.enabled?(:arel_package_scopes)
keyset_order = keyset_pagination_order(join_class: Project, column_name: :path, direction: :desc)
keyset_order = keyset_pagination_order(join_class: Project, column_name: :path, direction: :desc)
joins(:project).reorder(keyset_order)
else
joins(:project).reorder('projects.path DESC, id DESC')
end
joins(:project).reorder(keyset_order)
end
after_commit :update_composer_cache, on: :destroy, if: -> { composer? }
......
---
name: arel_package_scopes
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62042
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/331306
milestone: '13.12'
type: development
group: group::package
default_enabled: false
......@@ -757,19 +757,8 @@ RSpec.describe Packages::Package, type: :model do
end
end
context 'with arel scope feature flag enabled' do
it_behaves_like 'order_project_path scope'
it_behaves_like 'order_project_path_desc scope'
end
context 'with feature flag disabled' do
before do
stub_feature_flags(arel_package_scopes: false)
end
it_behaves_like 'order_project_path scope'
it_behaves_like 'order_project_path_desc scope'
end
it_behaves_like 'order_project_path scope'
it_behaves_like 'order_project_path_desc scope'
end
describe '.order_by_package_file' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment