mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-14 04:04:23 +00:00
Migrate data for tax_category_id from products to variants
This commit is contained in:
committed by
Maikel Linke
parent
e2094665c5
commit
64b29d40a8
15
db/migrate/20230714123324_migrate_tax_category.rb
Normal file
15
db/migrate/20230714123324_migrate_tax_category.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
class MigrateTaxCategory < ActiveRecord::Migration[7.0]
|
||||
def up
|
||||
migrate_tax_category
|
||||
end
|
||||
|
||||
def migrate_tax_category
|
||||
ActiveRecord::Base.connection.execute(<<-SQL
|
||||
UPDATE spree_variants
|
||||
SET tax_category_id = spree_products.tax_category_id
|
||||
FROM spree_products
|
||||
WHERE spree_variants.product_id = spree_products.id
|
||||
SQL
|
||||
)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user