-
-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(matrix): add indexes to optimise queries
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
db/migrations/20200106_create_indexes_on_latest_pact_publications.rb
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,17 @@ | ||
Sequel.migration do | ||
up do | ||
alter_table(:latest_pact_publication_ids_for_consumer_versions) do | ||
add_index [:consumer_id], name: 'ndx_latest_pact_publications_consumer_id' | ||
add_index [:provider_id], name: 'ndx_latest_pact_publications_provider_id' | ||
add_index [:consumer_version_id], name: 'ndx_latest_pact_publications_cv_id' | ||
end | ||
end | ||
|
||
down do | ||
alter_table(:latest_pact_publication_ids_for_consumer_versions) do | ||
drop_index [:consumer_id], name: 'ndx_latest_pact_publications_consumer_id' | ||
drop_index [:provider_id], name: 'ndx_latest_pact_publications_provider_id' | ||
drop_index [:consumer_version_id], name: 'ndx_latest_pact_publications_cv_id' | ||
end | ||
end | ||
end |
17 changes: 17 additions & 0 deletions
17
db/migrations/20200107_create_indexes_on_latest_verifications.rb
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,17 @@ | ||
Sequel.migration do | ||
up do | ||
alter_table(:latest_verification_id_for_pact_version_and_provider_version) do | ||
add_index [:consumer_id], name: 'ndx_latest_verification_consumer_id' | ||
add_index [:provider_id], name: 'ndx_latest_verification_provider_id' | ||
add_index [:provider_version_id], name: 'ndx_latest_verification_provider_version_id' | ||
end | ||
end | ||
|
||
down do | ||
alter_table(:latest_verification_id_for_pact_version_and_provider_version) do | ||
drop_index [:consumer_id], name: 'ndx_latest_verification_consumer_id' | ||
drop_index [:provider_id], name: 'ndx_latest_verification_provider_id' | ||
drop_index [:provider_version_id], name: 'ndx_latest_verification_provider_version_id' | ||
end | ||
end | ||
end |