Add migration to reset negative stock levels to zero

This commit is contained in:
Matt-Yorkley
2019-09-06 17:20:41 +01:00
parent 4656c35f71
commit 11ea852211

View File

@@ -0,0 +1,6 @@
class ResetNegativeStockLevels < ActiveRecord::Migration
def up
# Reset stock to zero for all on_demand variants that have negative stock
execute "UPDATE spree_stock_items SET count_on_hand = '0' WHERE count_on_hand < 0 AND backorderable IS TRUE"
end
end