diff options
author | Micaël Bergeron <mbergeron@gitlab.com> | 2018-02-26 14:14:00 -0500 |
---|---|---|
committer | Micaël Bergeron <mbergeron@gitlab.com> | 2018-03-01 10:38:37 -0500 |
commit | 40a3b467f25df62fab4b92a3700846f06ef7534c (patch) | |
tree | 36a810dda2811035af976a89eb4756ff12245f48 /app/models | |
parent | e43d7d2b4d4ccae4e7c7c89b68b6dc3ae8f34bb7 (diff) | |
download | gitlab-ce-40a3b467f25df62fab4b92a3700846f06ef7534c.tar.gz |
add the Ci::Build `*_store` column
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/ci/build.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 53a0d787988..715ab55a100 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -3,6 +3,7 @@ module Ci prepend ArtifactMigratable include TokenAuthenticatable include AfterCommitQueue + include ObjectStorage::BackgroundMove include Presentable include Importable @@ -41,10 +42,13 @@ module Ci scope :unstarted, ->() { where(runner_id: nil) } scope :ignore_failures, ->() { where(allow_failure: false) } + scope :with_artifacts, ->() do where('(artifacts_file IS NOT NULL AND artifacts_file <> ?) OR EXISTS (?)', '', Ci::JobArtifact.select(1).where('ci_builds.id = ci_job_artifacts.job_id')) end + scope :with_artifacts_stored_locally, -> { with_artifacts.where(artifacts_file_store: [nil, LegacyArtifactUploader::Store::LOCAL]) } + scope :with_artifacts_not_expired, ->() { with_artifacts.where('artifacts_expire_at IS NULL OR artifacts_expire_at > ?', Time.now) } scope :with_expired_artifacts, ->() { with_artifacts.where('artifacts_expire_at < ?', Time.now) } scope :with_artifacts_stored_locally, ->() { with_artifacts.where(artifacts_file_store: [nil, LegacyArtifactUploader::Store::LOCAL]) } |