mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-06 07:29:16 +00:00
Migrate data for shipping_category_id
This commit is contained in:
15
db/migrate/20230715145329_migrate_shipping_category.rb
Normal file
15
db/migrate/20230715145329_migrate_shipping_category.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
class MigrateShippingCategory < ActiveRecord::Migration[7.0]
|
||||
def up
|
||||
migrate_shipping_category
|
||||
end
|
||||
|
||||
def migrate_shipping_category
|
||||
ActiveRecord::Base.connection.execute(<<-SQL
|
||||
UPDATE spree_variants
|
||||
SET shipping_category_id = spree_products.shipping_category_id
|
||||
FROM spree_products
|
||||
WHERE spree_variants.product_id = spree_products.id
|
||||
SQL
|
||||
)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user