Sha256: da3c74e5a3cf8be931dad2e07830352787674d078bbc9390d702cfed7b320eab

Contents?: true

Size: 426 Bytes

Versions: 9

Compression:

Stored size: 426 Bytes

Contents

# This migration comes from spree (originally 20130806145853)
class SetDefaultStockLocationOnShipments < ActiveRecord::Migration[4.2]
  def change
    if Spree::Shipment.where('stock_location_id IS NULL').count > 0
      location = Spree::StockLocation.find_by(name: 'default') || Spree::StockLocation.first
      Spree::Shipment.where('stock_location_id IS NULL').update_all(stock_location_id: location.id)
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
spree_purchase_order-3.7.0 spec/dummy/db/migrate/20191113195792_set_default_stock_location_on_shipments.spree.rb
spree_billing_sisow-0.9.2 spec/dummy/db/migrate/20190729091733_set_default_stock_location_on_shipments.spree.rb
spree_billing_sisow-0.9.1 spec/dummy/db/migrate/20190729091733_set_default_stock_location_on_shipments.spree.rb
spree_purchase_order-3.6.0 spec/dummy/db/migrate/20180516181921_set_default_stock_location_on_shipments.spree.rb
spree_purchase_order-3.5.0 spec/dummy/db/migrate/20180516181921_set_default_stock_location_on_shipments.spree.rb
spree_purchase_order-3.5.0.rc1 spec/dummy/db/migrate/20180516181921_set_default_stock_location_on_shipments.spree.rb
spree_purchase_order-3.4.0 spec/dummy/db/migrate/20180516181921_set_default_stock_location_on_shipments.spree.rb
spree_purchase_order-3.3.0 spec/dummy/db/migrate/20180516181921_set_default_stock_location_on_shipments.spree.rb
spree_purchase_order-3.2.0 spec/dummy/db/migrate/20180516181921_set_default_stock_location_on_shipments.spree.rb