Sha256: 11458aa71be759a06e4ffa5b3a17536ddeff394709dffedc5773e4ddae07849d

Contents?: true

Size: 500 Bytes

Versions: 9

Compression:

Stored size: 500 Bytes

Contents

# This migration comes from spree (originally 20130417120035)
class UpdateAdjustmentStates < ActiveRecord::Migration[4.2]
  def up
    Spree::Order.complete.find_each do |order|
      order.adjustments.update_all(state: 'closed')
    end

    Spree::Shipment.shipped.includes(:adjustment).find_each do |shipment|
      shipment.adjustment.update_column(:state, 'finalized') if shipment.adjustment
    end

    Spree::Adjustment.where(state: nil).update_all(state: 'open')
  end

  def down
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
spree_purchase_order-3.7.0 spec/dummy/db/migrate/20191113195767_update_adjustment_states.spree.rb
spree_billing_sisow-0.9.2 spec/dummy/db/migrate/20190729091708_update_adjustment_states.spree.rb
spree_billing_sisow-0.9.1 spec/dummy/db/migrate/20190729091708_update_adjustment_states.spree.rb
spree_purchase_order-3.6.0 spec/dummy/db/migrate/20180516181896_update_adjustment_states.spree.rb
spree_purchase_order-3.5.0 spec/dummy/db/migrate/20180516181896_update_adjustment_states.spree.rb
spree_purchase_order-3.5.0.rc1 spec/dummy/db/migrate/20180516181896_update_adjustment_states.spree.rb
spree_purchase_order-3.4.0 spec/dummy/db/migrate/20180516181896_update_adjustment_states.spree.rb
spree_purchase_order-3.3.0 spec/dummy/db/migrate/20180516181896_update_adjustment_states.spree.rb
spree_purchase_order-3.2.0 spec/dummy/db/migrate/20180516181896_update_adjustment_states.spree.rb