summaryrefslogtreecommitdiff
path: root/app/models/ci/stage.rb
blob: ca89caf478271a31ae3ca3197a3ebf17a62f59b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module Ci
  class Stage < ActiveRecord::Base
    extend Ci::Model
    include Importable
    include HasStatus

    enumerated_status!

    belongs_to :project
    belongs_to :pipeline

    has_many :commit_statuses, foreign_key: :stage_id
    has_many :builds, foreign_key: :stage_id

    validates :project, presence: true, unless: :importing?
    validates :pipeline, presence: true, unless: :importing?
    validates :name, presence: true, unless: :importing?
  end
end