Sha256: 612ce92789d08c2a8916ce5714683d26ca25996769bc4cb92eb0d38279f91faf

Contents?: true

Size: 514 Bytes

Versions: 9

Compression:

Stored size: 514 Bytes

Contents

# This migration comes from spree (originally 20140601011216)
class SetShipmentTotalForUsersUpgrading < ActiveRecord::Migration
  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 & 4 rubygems

Version Path
spree_weight_calculator-0.1.0 test/dummy/db/migrate/20160723192575_set_shipment_total_for_users_upgrading.spree.rb
spree_order_reporting-0.0.3 spec/dummy/db/migrate/20160708163172_set_shipment_total_for_users_upgrading.spree.rb
spree_order_reporting-0.0.2 spec/dummy/db/migrate/20160707103496_set_shipment_total_for_users_upgrading.spree.rb
spree_order_reporting-0.0.1 spec/dummy/db/migrate/20160706112448_set_shipment_total_for_users_upgrading.spree.rb
spree_mercado_pago-0.2.3 spec/dummy/db/migrate/20141204014766_set_shipment_total_for_users_upgrading.spree.rb
spree_mercado_pago-0.2.2 spec/dummy/db/migrate/20141204014766_set_shipment_total_for_users_upgrading.spree.rb
spree_mercado_pago-0.2.1 spec/dummy/db/migrate/20141112193549_set_shipment_total_for_users_upgrading.spree.rb
spree_mercado_pago-0.2.0 spec/dummy/db/migrate/20141112193549_set_shipment_total_for_users_upgrading.spree.rb
spree_mercado_pago_payment_method-0.2.0 spec/dummy/db/migrate/20141112193549_set_shipment_total_for_users_upgrading.spree.rb