blob: 54a54c42fd1e964f777a8415fbdbae4dc47a2ff6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# frozen_string_literal: true
module Ci
class BuildNeed < Ci::ApplicationRecord
include Ci::Partitionable
include IgnorableColumns
include BulkInsertSafe
MAX_JOB_NAME_LENGTH = 255
belongs_to :build,
->(need) { in_partition(need) },
class_name: 'Ci::Processable',
foreign_key: :build_id,
partition_foreign_key: :partition_id,
inverse_of: :needs
partitionable scope: :build
validates :build, presence: true
validates :name, presence: true, length: { maximum: MAX_JOB_NAME_LENGTH }
validates :optional, inclusion: { in: [true, false] }
scope :scoped_build, -> {
where(arel_table[:build_id].eq(Ci::Build.arel_table[:id]))
.where(arel_table[:partition_id].eq(Ci::Build.arel_table[:partition_id]))
}
scope :artifacts, -> { where(artifacts: true) }
end
end
|