Sha256: 429982cd13e166d5a959a7b0c7fdfcc345e0d18d18d45b5c60aeb3ccfffd8729

Contents?: true

Size: 731 Bytes

Versions: 122

Compression:

Stored size: 731 Bytes

Contents

Sequel.migration do
  up do
    # consumer_id and provider_id are redundant by avoid making extra joins when creating views
    rows = from(:verifications).select_group(
          Sequel[:verifications][:consumer_id],
          Sequel[:verifications][:pact_version_id],
          Sequel[:verifications][:provider_id],
          Sequel[:verifications][:provider_version_id])
        .select_append{ max(verifications[id]).as(verification_id) }

    # The danger with this migration is that a verification created by an old node will be lost
    from(:latest_verification_id_for_pact_version_and_provider_version).insert(rows)
  end

  down do
    from(:latest_verification_id_for_pact_version_and_provider_version).delete
  end
end

Version data entries

122 entries across 122 versions & 1 rubygems

Version Path
pact_broker-2.26.0 db/migrations/20180724_migrate_latest_verification_ids.rb
pact_broker-2.25.0 db/migrations/20180724_migrate_latest_verification_ids.rb