Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Fix MySQL error with upsert_all
Damian Legawiec69e8333b36db
diff --git a/core/app/models/spree/price_list.rb b/core/app/models/spree/price_list.rbindex 02687071bb..4d0d0d398e 100644--- a/core/app/models/spree/price_list.rb+++ b/core/app/models/spree/price_list.rb@@ -177,11 +177,10 @@ module Spreereturn true if records_to_upsert.empty?- Spree::Price.upsert_all(- records_to_upsert,- unique_by: :id,- update_only: [:amount, :compare_at_amount]- )+ opts = { update_only: [:amount, :compare_at_amount] }+ opts[:unique_by] = :id unless ActiveRecord::Base.connection.adapter_name == 'Mysql2'++ Spree::Price.upsert_all(records_to_upsert, **opts)touch_variants(variant_ids.to_a)true