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.

Skip executing code logic in multi promo code migration in test env (#12623)

Damian Legawiec4de91b25a6fb
diff --git a/core/db/migrate/20241005093437_add_multi_code_to_spree_promotions.rb b/core/db/migrate/20241005093437_add_multi_code_to_spree_promotions.rb
index c027d63532..4b707a4383 100644
--- a/core/db/migrate/20241005093437_add_multi_code_to_spree_promotions.rb
+++ b/core/db/migrate/20241005093437_add_multi_code_to_spree_promotions.rb
@@ -7,8 +7,10 @@ class AddMultiCodeToSpreePromotions < ActiveRecord::Migration[6.1]
add_index :spree_promotions, :kind, if_not_exists: true
- Spree::Promotion.reset_column_information
- # set all promotions without a code to automatic
- Spree::Promotion.where(code: [nil, '']).update_all(kind: 1)
+ unless Rails.env.test?
+ Spree::Promotion.reset_column_information
+ # set all promotions without a code to automatic
+ Spree::Promotion.where(code: [nil, '']).update_all(kind: 1)
+ end
end
end