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 unique name migrations in multi tenant environment (#12984)

Damian Legawiec57765c250877
diff --git a/core/db/migrate/20250730102644_add_missing_unique_indexes_to_spree_option_types_and_values.rb b/core/db/migrate/20250730102644_add_missing_unique_indexes_to_spree_option_types_and_values.rb
index bcc0af7191..61ee0d5bd9 100644
--- a/core/db/migrate/20250730102644_add_missing_unique_indexes_to_spree_option_types_and_values.rb
+++ b/core/db/migrate/20250730102644_add_missing_unique_indexes_to_spree_option_types_and_values.rb
@@ -1,5 +1,8 @@
class AddMissingUniqueIndexesToSpreeOptionTypesAndValues < ActiveRecord::Migration[7.2]
def change
+ # we don't need to run this migration in multi-tenant mode as it's already handled there
+ return if defined?(SpreeMultiTenant)
+
# Rename duplicated option types
duplicates = Spree::OptionType.select(:name).group(:name).having('COUNT(*) > 1').reorder('').pluck(:name)
diff --git a/core/db/migrate/20250730154601_add_unique_index_on_spree_properties_name.rb b/core/db/migrate/20250730154601_add_unique_index_on_spree_properties_name.rb
index af707a6010..442f6d3116 100644
--- a/core/db/migrate/20250730154601_add_unique_index_on_spree_properties_name.rb
+++ b/core/db/migrate/20250730154601_add_unique_index_on_spree_properties_name.rb
@@ -1,5 +1,8 @@
class AddUniqueIndexOnSpreePropertiesName < ActiveRecord::Migration[7.2]
def change
+ # we don't need to run this migration in multi-tenant mode as it's already handled there
+ return if defined?(SpreeMultiTenant)
+
# Rename duplicated properties
duplicates = Spree::Property.select(:name).group(:name).having('COUNT(*) > 1').reorder('').pluck(:name)