diff --git a/db/ddl_statements/latest_tagged_pact_consumer_version_orders.rb b/db/ddl_statements/latest_tagged_pact_consumer_version_orders.rb index f80505337..6e8164ea5 100644 --- a/db/ddl_statements/latest_tagged_pact_consumer_version_orders.rb +++ b/db/ddl_statements/latest_tagged_pact_consumer_version_orders.rb @@ -15,7 +15,7 @@ def latest_tagged_pact_consumer_version_orders_v3(connection) connection.from(view) .select_group( Sequel[:lp][:provider_id], - Sequel[:cv][:pacticipant_id].as(:consumer_id), + Sequel[:lp][:consumer_id] Sequel[:t][:name].as(:tag_name)) .select_append{ max(order).as(latest_consumer_version_order) } .join(:versions, { Sequel[:lp][:consumer_version_id] => Sequel[:cv][:id] }, { table_alias: :cv} ) diff --git a/db/migrations/20180722_recreate_views.rb b/db/migrations/20180722_recreate_views.rb index f93196fe6..900333cd3 100644 --- a/db/migrations/20180722_recreate_views.rb +++ b/db/migrations/20180722_recreate_views.rb @@ -12,14 +12,7 @@ # Latest consumer version order for consumer/provider # Recreate latest_pact_publication_ids_for_consumer_versions view - lpp = :latest_pact_publication_ids_for_consumer_versions - latest_pact_consumer_version_orders = from(lpp).select_group( - Sequel[lpp][:provider_id], - Sequel[:cv][:pacticipant_id].as(:consumer_id)) - .select_append{ max(order).as(latest_consumer_version_order) } - .join(:versions, { Sequel[lpp][:consumer_version_id] => Sequel[:cv][:id] }, { table_alias: :cv }) - - create_or_replace_view(:latest_pact_consumer_version_orders, latest_pact_consumer_version_orders) + create_or_replace_view(:latest_pact_consumer_version_orders, latest_pact_consumer_version_orders_v2(self)) end down do diff --git a/db/migrations/20191029_optimise_latest_pact_cv_orders.rb b/db/migrations/20191029_optimise_latest_pact_cv_orders.rb deleted file mode 100644 index 96124805c..000000000 --- a/db/migrations/20191029_optimise_latest_pact_cv_orders.rb +++ /dev/null @@ -1,13 +0,0 @@ -require_relative '../ddl_statements' - -Sequel.migration do - up do - create_or_replace_view(:latest_pact_consumer_version_orders, - latest_pact_consumer_version_orders_v2(self)) - end - - down do - create_or_replace_view(:latest_pact_consumer_version_orders, - latest_pact_consumer_version_orders_v1(self)) - end -end