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.

change migration file to work for other user types

wjwitek521d54c0ef39
diff --git a/core/db/migrate/20221215151408_add_selected_locale_to_spree_users.rb b/core/db/migrate/20221215151408_add_selected_locale_to_spree_users.rb
index c1e7546359..3655429b29 100644
--- a/core/db/migrate/20221215151408_add_selected_locale_to_spree_users.rb
+++ b/core/db/migrate/20221215151408_add_selected_locale_to_spree_users.rb
@@ -1,5 +1,8 @@
class AddSelectedLocaleToSpreeUsers < ActiveRecord::Migration[7.0]
def change
- add_column :spree_users, :selected_locale, :string
+ if Spree.user_class.present?
+ users_table_name = Spree.user_class.table_name
+ add_column users_table_name, :selected_locale, :string unless column_exists?(users_table_name, :selected_locale)
+ end
end
end