debian-mirror-gitlab/app/models/ci/sources/pipeline.rb

32 lines
1.1 KiB
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
module Ci
module Sources
2021-10-27 15:23:28 +05:30
class Pipeline < Ci::ApplicationRecord
include Ci::NamespacedModelName
2021-11-11 11:23:49 +05:30
include IgnorableColumns
ignore_columns 'source_job_id_convert_to_bigint', remove_with: '14.5', remove_after: '2021-11-22'
2021-10-27 15:23:28 +05:30
2019-12-21 20:55:43 +05:30
self.table_name = "ci_sources_pipelines"
belongs_to :project, class_name: "Project"
belongs_to :pipeline, class_name: "Ci::Pipeline", inverse_of: :source_pipeline
belongs_to :source_project, class_name: "Project", foreign_key: :source_project_id
belongs_to :source_job, class_name: "CommitStatus", foreign_key: :source_job_id
2020-03-13 15:44:24 +05:30
belongs_to :source_bridge, class_name: "Ci::Bridge", foreign_key: :source_job_id
2019-12-21 20:55:43 +05:30
belongs_to :source_pipeline, class_name: "Ci::Pipeline", foreign_key: :source_pipeline_id
validates :project, presence: true
validates :pipeline, presence: true
validates :source_project, presence: true
validates :source_job, presence: true
validates :source_pipeline, presence: true
2020-03-13 15:44:24 +05:30
scope :same_project, -> { where(arel_table[:source_project_id].eq(arel_table[:project_id])) }
2019-12-21 20:55:43 +05:30
end
end
end