mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-11 18:26:50 +00:00
Enable master variants with associated order cycles
There's only 5 in UK prod. keeping them is easier than figuring out if it's safe to delete.
(cherry picked from commit 4bf65e330b)
This commit is contained in:
@@ -5,6 +5,7 @@ class RemoveMasterVariants < ActiveRecord::Migration[7.0]
|
||||
end
|
||||
|
||||
handle_master_line_items
|
||||
handle_master_exchange_variants
|
||||
delete_master_inventory_units
|
||||
delete_master_variant_prices
|
||||
delete_master_stock_items
|
||||
@@ -24,6 +25,17 @@ class RemoveMasterVariants < ActiveRecord::Migration[7.0]
|
||||
)
|
||||
end
|
||||
|
||||
def handle_master_exchange_variants
|
||||
ActiveRecord::Base.connection.execute(<<-SQL
|
||||
UPDATE spree_variants
|
||||
SET is_master = false
|
||||
FROM exchange_variants
|
||||
WHERE spree_variants.is_master = true
|
||||
AND spree_variants.id = exchange_variants.variant_id
|
||||
SQL
|
||||
)
|
||||
end
|
||||
|
||||
def delete_master_inventory_units
|
||||
ActiveRecord::Base.connection.execute(<<-SQL
|
||||
DELETE FROM spree_inventory_units
|
||||
|
||||
Reference in New Issue
Block a user