Migrate data for tax_category_id from products to variants

This commit is contained in:
Matt-Yorkley
2023-07-14 13:49:34 +01:00
committed by Maikel Linke
parent e2094665c5
commit 64b29d40a8

View 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