|
| 1 | +# The latest verification id for each consumer version tag |
| 2 | +# This is not: |
| 3 | +# find latest pacticipant version with given tag |
| 4 | +# -> find the latest pact |
| 5 | +# -> find the latest verification |
| 6 | +# because the latest pacticipant version with the tag might not have a pact, |
| 7 | +# and the latest pact might not have a verification. |
| 8 | + |
| 9 | +# This is: |
| 10 | +# join the tags and the pacticipant versions and the verifications and find the "latest" row |
| 11 | + |
| 12 | +LATEST_VERIFICATION_IDS_FOR_CONSUMER_VERSION_TAGS_V1 = "select |
| 13 | + pv.pacticipant_id as provider_id, |
| 14 | + lpp.consumer_id, |
| 15 | + t.name as consumer_version_tag_name, |
| 16 | + max(v.id) as latest_verification_id |
| 17 | + from verifications v |
| 18 | + join latest_pact_publications_by_consumer_versions lpp |
| 19 | + on v.pact_version_id = lpp.pact_version_id |
| 20 | + join tags t |
| 21 | + on lpp.consumer_version_id = t.version_id |
| 22 | + join versions pv |
| 23 | + on v.provider_version_id = pv.id |
| 24 | + group by pv.pacticipant_id, lpp.consumer_id, t.name" |
| 25 | + |
| 26 | +LATEST_VERIFICATION_IDS_FOR_CONSUMER_VERSION_TAGS_V2 = "select |
| 27 | + pv.pacticipant_id as provider_id, |
| 28 | + lpp.consumer_id, |
| 29 | + t.name as consumer_version_tag_name, |
| 30 | + max(v.id) as latest_verification_id |
| 31 | + from verifications v |
| 32 | + join latest_pact_publication_ids_for_consumer_versions lpp |
| 33 | + on v.pact_version_id = lpp.pact_version_id |
| 34 | + join tags t |
| 35 | + on lpp.consumer_version_id = t.version_id |
| 36 | + join versions pv |
| 37 | + on v.provider_version_id = pv.id |
| 38 | + group by pv.pacticipant_id, lpp.consumer_id, t.name" |
0 commit comments