summaryrefslogtreecommitdiff
path: root/app/models/ci/stage.rb
blob: c163d047127eeaa42f585009dacd0f439a40f109 (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

    enumerate_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