debian-mirror-gitlab/app/models/ci/build_need.rb
2023-07-09 08:55:56 +05:30

20 lines
628 B
Ruby

# frozen_string_literal: true
module Ci
class BuildNeed < Ci::ApplicationRecord
include Ci::Partitionable
include BulkInsertSafe
include IgnorableColumns
belongs_to :build, class_name: "Ci::Processable", foreign_key: :build_id, inverse_of: :needs
partitionable scope: :build
validates :build, presence: true
validates :name, presence: true, length: { maximum: 128 }
validates :optional, inclusion: { in: [true, false] }
scope :scoped_build, -> { where("#{Ci::Build.quoted_table_name}.id = #{quoted_table_name}.build_id") }
scope :artifacts, -> { where(artifacts: true) }
end
end