diff --git a/lib/pact_broker/matrix/quick_row.rb b/lib/pact_broker/matrix/quick_row.rb index baa1fa729..819a93ef8 100644 --- a/lib/pact_broker/matrix/quick_row.rb +++ b/lib/pact_broker/matrix/quick_row.rb @@ -72,6 +72,8 @@ class QuickRow < Sequel::Model(Sequel.as(:latest_pact_publication_ids_for_consum SELECT_ALL_COLUMN_ARGS = [:select_all_columns] + ALL_COLUMNS SELECT_PACTICIPANT_IDS_ARGS = [:select_pacticipant_ids, Sequel[:p][:consumer_id], Sequel[:p][:provider_id]] + EAGER_LOADED_RELATIONSHIPS_FOR_VERSION = { current_deployed_versions: :environment, current_supported_released_versions: :environment, branch_versions: [:branch_head, :version, branch: :pacticipant] } + associate(:many_to_one, :pact_publication, :class => "PactBroker::Pacts::PactPublication", :key => :pact_publication_id, :primary_key => :id) associate(:many_to_one, :provider, :class => "PactBroker::Domain::Pacticipant", :key => :provider_id, :primary_key => :id) associate(:many_to_one, :consumer, :class => "PactBroker::Domain::Pacticipant", :key => :consumer_id, :primary_key => :id) @@ -141,6 +143,7 @@ def order_by_pact_publication_created_at order(Sequel.desc(:consumer_version_created_at), Sequel.desc(:pact_order)) end + # eager load tags? def eager_all_the_things eager( :consumer, @@ -148,8 +151,8 @@ def eager_all_the_things :verification, :pact_publication, :pact_version, - consumer_version: { current_deployed_versions: :environment, current_supported_released_versions: :environment, branch_versions: [:branch_head, :version, branch: :pacticipant] }, - provider_version: { current_deployed_versions: :environment, current_supported_released_versions: :environment, branch_versions: [:branch_head, :version, branch: :pacticipant] }, + consumer_version: EAGER_LOADED_RELATIONSHIPS_FOR_VERSION, + provider_version: EAGER_LOADED_RELATIONSHIPS_FOR_VERSION, consumer_version_tags: { version: :pacticipant }, provider_version_tags: { version: :pacticipant } )