Skip to content

armgit / spree

Public Imported from GitHub
0

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.

upgrade task fixes

Damian Legawiec4f0999764784
diff --git a/spree/core/lib/spree/upgrades/5_4_to_5_5/manifest.yml b/spree/core/lib/spree/upgrades/5_4_to_5_5/manifest.yml
index 0459f88a4f..5bf06a79e5 100644
--- a/spree/core/lib/spree/upgrades/5_4_to_5_5/manifest.yml
+++ b/spree/core/lib/spree/upgrades/5_4_to_5_5/manifest.yml
@@ -41,3 +41,13 @@ steps:
Until this runs, every product has store_id IS NULL and is invisible
to Product.for_store — admin lists, storefront catalog, and search
indexer all return empty.
+
+ - id: reindex
+ name: "Reindex products against the configured search provider"
+ task: "spree:search:reindex"
+ notes: |
+ No-op for the default Database provider. For Meilisearch (or any other
+ external search provider), this is required after the channels upgrade
+ because products only become visible to Product.for_store once they
+ have a store_id — reindexing before the channels step would index 0
+ products. Must run AFTER `channels`.
diff --git a/spree/core/lib/tasks/upgrade.rake b/spree/core/lib/tasks/upgrade.rake
index 919cf14f2e..174d3a30fb 100644
--- a/spree/core/lib/tasks/upgrade.rake
+++ b/spree/core/lib/tasks/upgrade.rake
@@ -117,7 +117,10 @@ module Spree
print_manifest_header(manifest)
manifest['steps'].each_with_index do |step, i|
print_step(step, i + 1, manifest['steps'].size)
- invoke(step) unless dry_run
+ unless dry_run
+ invoke(step)
+ print_step_complete(step)
+ end
end
end
@@ -145,7 +148,10 @@ module Spree
manifest, step = matches.first
print_manifest_header(manifest)
print_step(step, 1, 1)
- invoke(step) unless dry_run
+ unless dry_run
+ invoke(step)
+ print_step_complete(step)
+ end
puts
puts dry_run ? ' (dry run — nothing executed)' : " Step '#{step_id}' complete."
@@ -167,6 +173,10 @@ module Spree
step['notes'].each_line { |line| puts " #{line.chomp}" }
end
+ def print_step_complete(step)
+ puts " ✓ #{step['task']} done."
+ end
+
def invoke(step)
task = step.fetch('task')
puts " Running #{task}..."