Sha256: da92706997ec97703032f8ce91eac60a846a4cac0a136d3d1d8d99506939e7e4

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

require 'models/job'
require 'model'
require 'models/repository'

# Build model
class Build < Model
  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
  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

  self.table_name = 'builds'

  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,
      :branches_for_that_this_build_is_last
    ]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
travis-backup-0.3.0 lib/models/build.rb