summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-06 03:08:02 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-06 03:08:02 +0000
commited73d4f207ef6cb8646719baa1188d096c9f3139 (patch)
treedea7ab9906154c73204a0361163e30500f929d44 /app/models/project.rb
parent2349eabc1a473bfb70555f0ce6d3d808cecb181d (diff)
downloadgitlab-ce-ed73d4f207ef6cb8646719baa1188d096c9f3139.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 03a99577d5c..301fcfc8c98 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -374,9 +374,17 @@ class Project < ApplicationRecord
scope :pending_delete, -> { where(pending_delete: true) }
scope :without_deleted, -> { where(pending_delete: false) }
- scope :with_storage_feature, ->(feature) { where('storage_version >= :version', version: HASHED_STORAGE_FEATURES[feature]) }
- scope :without_storage_feature, ->(feature) { where('storage_version < :version OR storage_version IS NULL', version: HASHED_STORAGE_FEATURES[feature]) }
- scope :with_unmigrated_storage, -> { where('storage_version < :version OR storage_version IS NULL', version: LATEST_STORAGE_VERSION) }
+ scope :with_storage_feature, ->(feature) do
+ where(arel_table[:storage_version].gteq(HASHED_STORAGE_FEATURES[feature]))
+ end
+ scope :without_storage_feature, ->(feature) do
+ where(arel_table[:storage_version].lt(HASHED_STORAGE_FEATURES[feature])
+ .or(arel_table[:storage_version].eq(nil)))
+ end
+ scope :with_unmigrated_storage, -> do
+ where(arel_table[:storage_version].lt(LATEST_STORAGE_VERSION)
+ .or(arel_table[:storage_version].eq(nil)))
+ end
# last_activity_at is throttled every minute, but last_repository_updated_at is updated with every push
scope :sorted_by_activity, -> { reorder(Arel.sql("GREATEST(COALESCE(last_activity_at, '1970-01-01'), COALESCE(last_repository_updated_at, '1970-01-01')) DESC")) }