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.

Put the data migration into its own migration file.

Matthew Kennedye95df3b78d3d
diff --git a/core/db/migrate/20210114220232_remove_store_id_from_spree_payment_methods.rb b/core/db/migrate/20210114220232_migrate_data_payment_methods_stores.rb
similarity index 69%
rename from core/db/migrate/20210114220232_remove_store_id_from_spree_payment_methods.rb
rename to core/db/migrate/20210114220232_migrate_data_payment_methods_stores.rb
index 8d78236cb9..e231b4315d 100644
--- a/core/db/migrate/20210114220232_remove_store_id_from_spree_payment_methods.rb
+++ b/core/db/migrate/20210114220232_migrate_data_payment_methods_stores.rb
@@ -1,4 +1,4 @@
-class RemoveStoreIdFromSpreePaymentMethods < ActiveRecord::Migration[6.0]
+class MigrateDataPaymentMethodsStores < ActiveRecord::Migration[6.0]
def up
Spree::PaymentMethod.all.each do |payment_method|
next if payment_method.store_ids.any?
@@ -12,8 +12,4 @@ class RemoveStoreIdFromSpreePaymentMethods < ActiveRecord::Migration[6.0]
payment_method.save
end
end
-
- def change
- remove_column :spree_payment_methods, :store_id
- end
end
diff --git a/core/db/migrate/20210117112551_remove_store_id_from_spree_payment_methods.rb b/core/db/migrate/20210117112551_remove_store_id_from_spree_payment_methods.rb
new file mode 100644
index 0000000000..abf407866a
--- /dev/null
+++ b/core/db/migrate/20210117112551_remove_store_id_from_spree_payment_methods.rb
@@ -0,0 +1,5 @@
+class RemoveStoreIdFromSpreePaymentMethods < ActiveRecord::Migration[6.0]
+ def change
+ remove_column :spree_payment_methods, :store_id, :integer
+ end
+end