-
-
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): speed up loading of verification tags
- Loading branch information
Showing
10 changed files
with
66 additions
and
143 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
This file was deleted.
Oops, something went wrong.
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,28 @@ | ||
require_relative 'migration_helper' | ||
|
||
Sequel.migration do | ||
change do | ||
create_view(:latest_tagged_version_orders, | ||
PactBroker::MigrationHelper.sqlite_safe(" | ||
select v.pacticipant_id, t.name as tag_name, max(v.order) as latest_version_order, 1 as latest | ||
from tags t | ||
inner join versions v | ||
on v.id = t.version_id | ||
group by v.pacticipant_id, t.name | ||
") | ||
) | ||
|
||
create_view(:tags_with_latest_flag, | ||
PactBroker::MigrationHelper.sqlite_safe(" | ||
select t.*, ltvo.latest | ||
from tags t | ||
inner join versions v | ||
on v.id = t.version_id | ||
left outer join latest_tagged_version_orders ltvo | ||
on t.name = ltvo.tag_name | ||
and v.pacticipant_id = ltvo.pacticipant_id | ||
and v.order = ltvo.latest_version_order | ||
") | ||
) | ||
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
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,18 @@ | ||
require 'pact_broker/db' | ||
require 'pact_broker/repositories/helpers' | ||
|
||
module PactBroker | ||
module Tags | ||
# The tag associated with the latest verification for a given tag | ||
class TagWithLatestFlag < Sequel::Model(:tags_with_latest_flag) | ||
|
||
dataset_module do | ||
include PactBroker::Repositories::Helpers | ||
end | ||
|
||
def latest? | ||
!values[:latest].nil? | ||
end | ||
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
85 changes: 0 additions & 85 deletions
85
spec/migrations/20180123_create_latest_verification_tags_spec.rb
This file was deleted.
Oops, something went wrong.