2019-08-01 14:26:49 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Ci
|
2021-08-03 06:08:50 +00:00
|
|
|
class BuildNeed < Ci::ApplicationRecord
|
2020-07-15 12:09:26 +00:00
|
|
|
include BulkInsertSafe
|
2021-04-23 12:09:52 +00:00
|
|
|
|
2020-12-24 18:10:25 +00:00
|
|
|
belongs_to :build, class_name: "Ci::Processable", foreign_key: :build_id, inverse_of: :needs
|
2019-08-01 14:26:49 +00:00
|
|
|
|
|
|
|
validates :build, presence: true
|
|
|
|
validates :name, presence: true, length: { maximum: 128 }
|
2021-03-15 18:09:05 +00:00
|
|
|
validates :optional, inclusion: { in: [true, false] }
|
2019-08-01 14:26:49 +00:00
|
|
|
|
|
|
|
scope :scoped_build, -> { where('ci_builds.id=ci_build_needs.build_id') }
|
2019-11-27 15:06:45 +00:00
|
|
|
scope :artifacts, -> { where(artifacts: true) }
|
2019-08-01 14:26:49 +00:00
|
|
|
end
|
|
|
|
end
|