Sha256: 22be4cc39aa807ce393945018a4d705a3c0d7e60360b771547e514e28824b930

Contents?: true

Size: 1.39 KB

Versions: 78

Compression:

Stored size: 1.39 KB

Contents

Sequel.migration do
  up do
    # Latest pact_publication (revision) for each provider/consumer version.
    # Keeping track of this in a table rather than having to calculate the
    # latest revision speeds things up.
    # We don't have to worry about updating it if a revision is deleted, because
    # you can't delete a single pact revision through the API - all the revisions
    # for a pact are deleted together when you delete the pact resource for that
    # consumer version, and when that happens, this row will cascade delete.

    create_table(:latest_pact_publication_ids_for_consumer_versions, charset: 'utf8') do
      foreign_key :consumer_id, :pacticipants, null: false, on_delete: :cascade # redundant, but speeds up queries by removing need for extra join
      foreign_key :consumer_version_id, :versions, null: false, on_delete: :cascade
      foreign_key :provider_id, :pacticipants, null: false, on_delete: :cascade
      foreign_key :pact_publication_id, :pact_publications, null: false, on_delete: :cascade, unique: true
      foreign_key :pact_version_id, :pact_versions, null: false, on_delete: :cascade
      index [:provider_id, :consumer_version_id], unique: true, name: "unq_latest_ppid_prov_conver"
      index [:provider_id, :consumer_id], name: "lpp_provider_id_consumer_id_index"
    end
  end

  down do
    drop_table(:latest_pact_publication_ids_for_consumer_versions)
  end
end

Version data entries

78 entries across 78 versions & 1 rubygems

Version Path
pact_broker-2.79.1 db/migrations/20180720_create_latest_pact_publication_ids.rb
pact_broker-2.79.0 db/migrations/20180720_create_latest_pact_publication_ids.rb
pact_broker-2.78.1 db/migrations/20180720_create_latest_pact_publication_ids.rb
pact_broker-2.78.0 db/migrations/20180720_create_latest_pact_publication_ids.rb
pact_broker-2.77.0 db/migrations/20180720_create_latest_pact_publication_ids.rb
pact_broker-2.76.2 db/migrations/20180720_create_latest_pact_publication_ids.rb
pact_broker-2.76.1 db/migrations/20180720_create_latest_pact_publication_ids.rb
pact_broker-2.76.0 db/migrations/20180720_create_latest_pact_publication_ids.rb
pact_broker-2.75.0 db/migrations/20180720_create_latest_pact_publication_ids.rb
pact_broker-2.74.1 db/migrations/20180720_create_latest_pact_publication_ids.rb
pact_broker-2.74.0 db/migrations/20180720_create_latest_pact_publication_ids.rb
pact_broker-2.73.0 db/migrations/20180720_create_latest_pact_publication_ids.rb
pact_broker-2.72.0 db/migrations/20180720_create_latest_pact_publication_ids.rb
pact_broker-2.71.0 db/migrations/20180720_create_latest_pact_publication_ids.rb
pact_broker-2.70.0 db/migrations/20180720_create_latest_pact_publication_ids.rb
pact_broker-2.69.0 db/migrations/20180720_create_latest_pact_publication_ids.rb
pact_broker-2.68.1 db/migrations/20180720_create_latest_pact_publication_ids.rb
pact_broker-2.68.0 db/migrations/20180720_create_latest_pact_publication_ids.rb
pact_broker-2.67.0 db/migrations/20180720_create_latest_pact_publication_ids.rb
pact_broker-2.66.0 db/migrations/20180720_create_latest_pact_publication_ids.rb