-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.rb
More file actions
38 lines (32 loc) · 1.47 KB
/
build.rb
File metadata and controls
38 lines (32 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# frozen_string_literal: true
require 'model'
class Build < Model
self.inheritance_column = :_type_disabled
belongs_to :repository
belongs_to :owner, polymorphic: true
belongs_to :sender, polymorphic: true
belongs_to :related_branch, foreign_key: :branch_id, class_name: 'Branch'
belongs_to :commit
belongs_to :pull_request
belongs_to :tag
belongs_to :request
belongs_to :build_config, foreign_key: :config_id, class_name: 'BuildConfig'
has_many :jobs, -> { order('id') }, as: :source, dependent: :destroy
has_many :repos_for_that_this_build_is_current, foreign_key: :current_build_id, dependent: :destroy, class_name: 'Repository'
has_many :repos_for_that_this_build_is_last, foreign_key: :last_build_id, class_name: 'Repository'
has_many :tags_for_that_this_build_is_last, foreign_key: :last_build_id, class_name: 'Tag'
has_many :branches_for_that_this_build_is_last, foreign_key: :last_build_id, class_name: 'Branch'
has_many :stages
has_many :deleted_jobs, -> { order('id') }, as: :source, dependent: :destroy
has_many :deleted_tags_for_that_this_build_is_last, foreign_key: :last_build_id, class_name: 'DeletedTag'
has_many :deleted_stages
def self.default_dependencies_symbols_to_nullify
[
:repos_for_that_this_build_is_current,
:repos_for_that_this_build_is_last,
:tags_for_that_this_build_is_last,
:deleted_tags_for_that_this_build_is_last,
:branches_for_that_this_build_is_last,
]
end
end