Skip to content

Commit

Permalink
feat(matrix): add indexes to optimise queries
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Jan 6, 2020
1 parent 42556e7 commit cdc9aad
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
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 db/migrations/20200107_create_indexes_on_latest_verifications.rb
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

0 comments on commit cdc9aad

Please sign in to comment.