debian-mirror-gitlab/app/models/ci/build_need.rb

19 lines
533 B
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
module Ci
class BuildNeed < ApplicationRecord
extend Gitlab::Ci::Model
2020-07-28 23:09:34 +05:30
include BulkInsertSafe
2021-03-08 18:12:59 +05:30
belongs_to :build, class_name: "Ci::Processable", foreign_key: :build_id, inverse_of: :needs
2019-10-12 21:52:04 +05:30
validates :build, presence: true
validates :name, presence: true, length: { maximum: 128 }
2021-04-17 20:07:23 +05:30
validates :optional, inclusion: { in: [true, false] }
2019-10-12 21:52:04 +05:30
scope :scoped_build, -> { where('ci_builds.id=ci_build_needs.build_id') }
2020-01-01 13:55:28 +05:30
scope :artifacts, -> { where(artifacts: true) }
2019-10-12 21:52:04 +05:30
end
end