Welcome to mirror list, hosted at ThFree Co, Russian Federation.

runner_machine_build.rb « ci « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d4f2c4033373e7ab381ce927ae94c6bd0fc70502 (plain)
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
# frozen_string_literal: true

module Ci
  class RunnerMachineBuild < Ci::ApplicationRecord
    include Ci::Partitionable

    self.table_name = :p_ci_runner_machine_builds
    self.primary_key = :build_id

    partitionable scope: :build, partitioned: true

    belongs_to :build, inverse_of: :runner_machine_build, class_name: 'Ci::Build'
    belongs_to :runner_machine, inverse_of: :runner_machine_builds, class_name: 'Ci::RunnerMachine'

    validates :build, presence: true
    validates :runner_machine, presence: true

    scope :for_build, ->(build_id) { where(build_id: build_id) }

    def self.pluck_build_id_and_runner_machine_id
      select(:build_id, :runner_machine_id)
        .pluck(:build_id, :runner_machine_id)
        .to_h
    end
  end
end