mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Add migration to reset negative stock levels to zero
This commit is contained in:
6
db/migrate/20190906151259_reset_negative_stock_levels.rb
Normal file
6
db/migrate/20190906151259_reset_negative_stock_levels.rb
Normal 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
|
||||
Reference in New Issue
Block a user