2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Ci
|
2021-10-27 15:23:28 +05:30
|
|
|
class BuildNeed < Ci::ApplicationRecord
|
2023-03-04 22:38:38 +05:30
|
|
|
include Ci::Partitionable
|
2020-07-28 23:09:34 +05:30
|
|
|
include BulkInsertSafe
|
2023-04-23 21:23:45 +05:30
|
|
|
include IgnorableColumns
|
|
|
|
|
|
|
|
ignore_column :id_convert_to_bigint, remove_with: '16.0', remove_after: '2023-04-22'
|
2021-06-08 01:23:25 +05:30
|
|
|
|
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
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
partitionable scope: :build
|
|
|
|
|
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
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
scope :scoped_build, -> { where("#{Ci::Build.quoted_table_name}.id = #{quoted_table_name}.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
|