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.96.0 db/migrations/20180724_migrate_latest_verification_ids.rb
pact_broker-2.95.1 db/migrations/20180724_migrate_latest_verification_ids.rb
pact_broker-2.95.0 db/migrations/20180724_migrate_latest_verification_ids.rb
pact_broker-2.94.0 db/migrations/20180724_migrate_latest_verification_ids.rb
pact_broker-2.93.4 db/migrations/20180724_migrate_latest_verification_ids.rb
pact_broker-2.93.3 db/migrations/20180724_migrate_latest_verification_ids.rb
pact_broker-2.93.2 db/migrations/20180724_migrate_latest_verification_ids.rb
pact_broker-2.93.1 db/migrations/20180724_migrate_latest_verification_ids.rb
pact_broker-2.93.0 db/migrations/20180724_migrate_latest_verification_ids.rb
pact_broker-2.92.0 db/migrations/20180724_migrate_latest_verification_ids.rb
pact_broker-2.91.0 db/migrations/20180724_migrate_latest_verification_ids.rb
pact_broker-2.90.0 db/migrations/20180724_migrate_latest_verification_ids.rb
pact_broker-2.89.1 db/migrations/20180724_migrate_latest_verification_ids.rb
pact_broker-2.89.0 db/migrations/20180724_migrate_latest_verification_ids.rb
pact_broker-2.88.0 db/migrations/20180724_migrate_latest_verification_ids.rb
pact_broker-2.87.0 db/migrations/20180724_migrate_latest_verification_ids.rb
pact_broker-2.86.0 db/migrations/20180724_migrate_latest_verification_ids.rb
pact_broker-2.85.1 db/migrations/20180724_migrate_latest_verification_ids.rb
pact_broker-2.85.0 db/migrations/20180724_migrate_latest_verification_ids.rb
pact_broker-2.84.0 db/migrations/20180724_migrate_latest_verification_ids.rb