Sha256: 916c91a1de50572a654360af28bbcc93b5031916b198c7cd6bd4b4510ba3f141

Contents?: true

Size: 1.6 KB

Versions: 3

Compression:

Stored size: 1.6 KB

Contents

require "pact_broker/db"
require "pact_broker/repositories/helpers"

module PactBroker
  module Versions
    class BranchHead < Sequel::Model
      set_primary_key :branch_id
      unrestrict_primary_key

      plugin :upsert, identifying_columns: [:branch_id]

      associate(:many_to_one, :branch, :class => "PactBroker::Versions::Branch", :key => :branch_id, :primary_key => :id)
      associate(:many_to_one, :branch_version, :class => "PactBroker::Versions::BranchVersion", :key => :branch_version_id, :primary_key => :id)
      associate(:many_to_one, :version, :class => "PactBroker::Domain::Version", :key => :version_id, :primary_key => :id)

      def before_save
        super
        self.pacticipant_id = branch.pacticipant_id
        self.version_id = branch_version.version_id
        self.branch_name = branch.name
      end

      def branch_name
        branch.name
      end
    end
  end
end

# Table: branch_heads
# Columns:
#  branch_id         | integer | NOT NULL
#  branch_version_id | integer | NOT NULL
#  version_id        | integer | NOT NULL
#  pacticipant_id    | integer | NOT NULL
#  branch_name       | text    | NOT NULL
# Indexes:
#  branch_heads_branch_id_index      | UNIQUE btree (branch_id)
#  branch_heads_branch_name_index    | btree (branch_name)
#  branch_heads_pacticipant_id_index | btree (pacticipant_id)
#  branch_heads_version_id_index     | btree (version_id)
# Foreign key constraints:
#  branch_heads_branch_id_fkey         | (branch_id) REFERENCES branches(id) ON DELETE CASCADE
#  branch_heads_branch_version_id_fkey | (branch_version_id) REFERENCES branch_versions(id) ON DELETE CASCADE

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pact_broker-2.107.1 lib/pact_broker/versions/branch_head.rb
pact_broker-2.107.0 lib/pact_broker/versions/branch_head.rb
pact_broker-2.107.0.beta.1 lib/pact_broker/versions/branch_head.rb