diff --git a/db/migrations/20200106_create_indexes_on_latest_pact_publications.rb b/db/migrations/20200106_create_indexes_on_latest_pact_publications.rb new file mode 100644 index 000000000..e0b024d4d --- /dev/null +++ b/db/migrations/20200106_create_indexes_on_latest_pact_publications.rb @@ -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 diff --git a/db/migrations/20200107_create_indexes_on_latest_verifications.rb b/db/migrations/20200107_create_indexes_on_latest_verifications.rb new file mode 100644 index 000000000..a9c6cf8e1 --- /dev/null +++ b/db/migrations/20200107_create_indexes_on_latest_verifications.rb @@ -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