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
Abort the returns migration when rows fail
Damian Legawiecb82c1d4063e9
diff --git a/packages/dashboard/src/locales/fr.json b/packages/dashboard/src/locales/fr.jsonindex 0db9e37c92..07f9b61fdf 100644--- a/packages/dashboard/src/locales/fr.json+++ b/packages/dashboard/src/locales/fr.json@@ -2965,7 +2965,7 @@},"reasons": {"title": "Retours et motifs",- "description": "Les listes dans lesquelles votre équipe choisit lors des retours, réclamations et remboursements.",+ "description": "Les listes de motifs que votre équipe utilise pour les retours, réclamations et remboursements.","add_cta": "Ajouter un motif","add_sheet_title": "Ajouter un motif","edit_sheet_title": "Modifier le motif",diff --git a/spree/core/lib/spree/upgrades/5_6_to_6_0/manifest.yml b/spree/core/lib/spree/upgrades/5_6_to_6_0/manifest.ymlindex b8187e9f11..7d0c5c9592 100644--- a/spree/core/lib/spree/upgrades/5_6_to_6_0/manifest.yml+++ b/spree/core/lib/spree/upgrades/5_6_to_6_0/manifest.yml@@ -169,10 +169,11 @@ steps:no cursor to track, no state to reset. Tune the load size withBATCH_SIZE (default 500).- A row that can't be migrated is reported and skipped, not fatal — one- unconvertible authorization must not block a release. The task therefore- exits 0 even when rows failed, so read the printed list: every failure is- retried by simply running the task again.+ A row that can't be migrated is reported and skipped so one unconvertible+ authorization doesn't stop the batch, but the task then aborts rather than+ letting the upgrade proceed on top of incomplete returns history. Re-run+ to retry those rows — the task only looks at what isn't migrated yet — or+ pass SKIP_FAILED_ROWS=true to accept the gap and continue.- id: backfill_delivery_and_stock_store_idsname: "Bind delivery methods and stock locations to the default store"diff --git a/spree/core/lib/tasks/migrate_returns.rake b/spree/core/lib/tasks/migrate_returns.rakeindex a5b31f1a41..7b864c51f1 100644--- a/spree/core/lib/tasks/migrate_returns.rake+++ b/spree/core/lib/tasks/migrate_returns.rake@@ -287,6 +287,12 @@ namespace :spree dolegacy models themselves are deleted in 6.0. The tables stay in place asa rollback safety net and drop in 6.1.+ A row that can't be converted is reported and skipped so one bad+ authorization doesn't stop the batch, but the task then aborts, because+ an upgrade must not continue on top of incomplete returns history.+ Re-run to retry those rows, or pass SKIP_FAILED_ROWS=true to accept the+ gap and continue.+Set BATCH_SIZE to tune how many authorizations are loaded at a time(default 500).DESC@@ -302,9 +308,18 @@ namespace :spree doputs " Migrated #{result[:returns]} return(s) and #{result[:exchanges]} exchange(s); " \"skipped #{result[:skipped]}."- if result[:failed].any?- puts " #{result[:failed].size} row(s) could not be migrated — re-run to retry them:"- result[:failed].each { |line| puts " #{line}" }+ next if result[:failed].empty?++ # Aborts so upgrade automation stops here rather than carrying on with+ # returns history that is missing rows. Every failure is retried by+ # simply re-running — the task scopes itself to what isn't migrated yet.+ puts " #{result[:failed].size} row(s) could not be migrated:"+ result[:failed].each { |line| puts " #{line}" }++ if ENV['SKIP_FAILED_ROWS'] == 'true'+ puts ' Continuing anyway (SKIP_FAILED_ROWS=true).'+ else+ abort ' Re-run to retry them, or pass SKIP_FAILED_ROWS=true to accept the gap and continue.'endendend