diff options
author | Nick Thomas <nick@gitlab.com> | 2017-11-28 15:46:39 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2017-11-28 15:46:39 +0300 |
commit | 0185d7800b23daecd44abe8e9a0b2672a831e8be (patch) | |
tree | af69f53cbc9842246dd5c67f0985aaea69cbc40a /app/models | |
parent | 85ff313a1ecf3fc0ffbf1989533d4fa38bd8daf8 (diff) | |
parent | 58f32622ce9c2d08001da7b91065942cdc5a0f4a (diff) |
Merge branch 'hashed-storage-attachments-migration-path' into 'master'
Hashed storage attachments migration path
See merge request gitlab-org/gitlab-ce!15352
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/project.rb | 5 | ||||
-rw-r--r-- | app/models/storage/hashed_project.rb | 1 |
2 files changed, 3 insertions, 3 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index e276bd2422d..85d580fe0fa 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -273,8 +273,9 @@ class Project < ActiveRecord::Base scope :pending_delete, -> { where(pending_delete: true) } scope :without_deleted, -> { where(pending_delete: false) } - scope :with_hashed_storage, -> { where('storage_version >= 1') } - scope :with_legacy_storage, -> { where(storage_version: [nil, 0]) } + 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 :sorted_by_activity, -> { reorder(last_activity_at: :desc) } scope :sorted_by_stars, -> { reorder('projects.star_count DESC') } diff --git a/app/models/storage/hashed_project.rb b/app/models/storage/hashed_project.rb index f025f40994e..fae1b64961a 100644 --- a/app/models/storage/hashed_project.rb +++ b/app/models/storage/hashed_project.rb @@ -4,7 +4,6 @@ module Storage delegate :gitlab_shell, :repository_storage_path, to: :project ROOT_PATH_PREFIX = '@hashed'.freeze - STORAGE_VERSION = 1 def initialize(project) @project = project |