Sha256: 4e81da84d460f535d44c7aabdb477b37199a0e96440542fbed6c6d44e14c04ab

Contents?: true

Size: 519 Bytes

Versions: 9

Compression:

Stored size: 519 Bytes

Contents

# This migration comes from spree (originally 20140601011216)
class SetShipmentTotalForUsersUpgrading < ActiveRecord::Migration[4.2]
  def up
    # NOTE You might not need this at all unless you're upgrading from Spree 2.1.x
    # or below. For those upgrading this should populate the Order#shipment_total
    # for legacy orders
    Spree::Order.complete.where('shipment_total = ?', 0).includes(:shipments).find_each do |order|
      order.update_column(:shipment_total, order.shipments.sum(:cost))
    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/20191113195853_set_shipment_total_for_users_upgrading.spree.rb
spree_billing_sisow-0.9.2 spec/dummy/db/migrate/20190729091794_set_shipment_total_for_users_upgrading.spree.rb
spree_billing_sisow-0.9.1 spec/dummy/db/migrate/20190729091794_set_shipment_total_for_users_upgrading.spree.rb
spree_purchase_order-3.6.0 spec/dummy/db/migrate/20180516181982_set_shipment_total_for_users_upgrading.spree.rb
spree_purchase_order-3.5.0 spec/dummy/db/migrate/20180516181982_set_shipment_total_for_users_upgrading.spree.rb
spree_purchase_order-3.5.0.rc1 spec/dummy/db/migrate/20180516181982_set_shipment_total_for_users_upgrading.spree.rb
spree_purchase_order-3.4.0 spec/dummy/db/migrate/20180516181982_set_shipment_total_for_users_upgrading.spree.rb
spree_purchase_order-3.3.0 spec/dummy/db/migrate/20180516181982_set_shipment_total_for_users_upgrading.spree.rb
spree_purchase_order-3.2.0 spec/dummy/db/migrate/20180516181982_set_shipment_total_for_users_upgrading.spree.rb