diff --git a/core/db/migrate/20130213191427_create_default_stock.rb b/core/db/migrate/20130213191427_create_default_stock.rb index 3e58127ba95..013879d6c3b 100644 --- a/core/db/migrate/20130213191427_create_default_stock.rb +++ b/core/db/migrate/20130213191427_create_default_stock.rb @@ -5,17 +5,12 @@ def up location = Spree::StockLocation.new(name: 'default') location.save(validate: false) - Spree::StockItem.class_eval do - # Column name check here for #3805 - unless column_names.include?("deleted_at") - def self.acts_as_paranoid; end - end - end - Spree::Variant.all.each do |variant| - stock_item = location.stock_items.build(variant: variant) + stock_item = Spree::StockItem.unscoped.build(stock_location: location, variant: variant) stock_item.send(:count_on_hand=, variant.count_on_hand) - stock_item.save! + # Avoid running default_scope defined by acts_as_paranoid, related to #3805, + # validations would run a query with a delete_at column tha might not be present yet + stock_item.save! validate: false end remove_column :spree_variants, :count_on_hand