mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
remove variants with no product
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
class MigrateVariantUnitValues < ActiveRecord::Migration
|
||||
def up
|
||||
Spree::Variant.where(product_id: nil).find_each do |variant|
|
||||
variant.destroy
|
||||
end
|
||||
Spree::Variant.where(unit_value: [nil, Float::NAN]).find_each do |variant|
|
||||
variant.unit_value = 1
|
||||
variant.save
|
||||
|
||||
Reference in New Issue
Block a user