-
-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dashboard api): fix query for displaying dashboard with tags
- Loading branch information
Showing
11 changed files
with
333 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Sequel.migration do | ||
up do | ||
# a row for each of the latest pact publications, | ||
# and a row for each of the latest tagged pact publications | ||
create_view(:head_matrix, | ||
"SELECT matrix.*, hpp.tag_name as consumer_tag_name | ||
FROM latest_matrix_for_consumer_version_and_provider_version matrix | ||
INNER JOIN head_pact_publications hpp | ||
ON matrix.consumer_id = hpp.consumer_id | ||
AND matrix.provider_id = hpp.provider_id | ||
AND matrix.consumer_version_order = hpp.consumer_version_order | ||
INNER JOIN latest_verification_id_for_consumer_version_and_provider AS lv | ||
ON ((matrix.consumer_version_id = lv.consumer_version_id) | ||
AND (matrix.provider_id = lv.provider_id) | ||
AND ((matrix.verification_id = lv.latest_verification_id))) | ||
UNION | ||
SELECT matrix.*, hpp.tag_name as consumer_tag_name | ||
FROM latest_matrix_for_consumer_version_and_provider_version matrix | ||
INNER JOIN head_pact_publications hpp | ||
ON matrix.consumer_id = hpp.consumer_id | ||
AND matrix.provider_id = hpp.provider_id | ||
AND matrix.consumer_version_order = hpp.consumer_version_order | ||
where verification_id is null | ||
" | ||
) | ||
end | ||
|
||
down do | ||
drop_view(:head_matrix) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
Sequel.migration do | ||
up do | ||
create_table(:materialized_head_matrix, charset: 'utf8') do | ||
Integer :consumer_id, null: false | ||
String :consumer_name, null: false | ||
Integer :consumer_version_id, null: false | ||
String :consumer_version_number, null: false | ||
Integer :consumer_version_order, null: false | ||
Integer :pact_publication_id, null: false | ||
Integer :pact_version_id, null: false | ||
String :pact_version_sha, null: false | ||
Integer :pact_revision_number, null: false | ||
DateTime :pact_created_at, null: false | ||
Integer :provider_id, null: false | ||
String :provider_name, null: false | ||
Integer :provider_version_id | ||
String :provider_version_number | ||
Integer :provider_version_order | ||
Integer :verification_id | ||
Boolean :success | ||
Integer :verification_number | ||
DateTime :verification_executed_at | ||
String :verification_build_url | ||
String :consumer_tag_name | ||
index [:consumer_id], name: 'ndx_mhm_consumer_id' | ||
index [:provider_id], name: 'ndx_mhm_provider_id' | ||
index [:consumer_version_order], name: 'ndx_mhm_cv_ord' | ||
end | ||
|
||
from(:materialized_head_matrix).insert(from(:head_matrix).select_all) | ||
end | ||
|
||
down do | ||
drop_table(:materialized_head_matrix) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
require 'pact_broker/matrix/row' | ||
|
||
module PactBroker | ||
module Matrix | ||
# A row for each of the overall latest pacts, and a row for each of the latest tagged pacts | ||
class HeadRow < Row | ||
set_dataset(:materialized_head_matrix) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.