Sha256: 495ab2dea69cf15765e99578d241b9985cd1792ccf676614cae73c3e3228b0e7

Contents?: true

Size: 491 Bytes

Versions: 7

Compression:

Stored size: 491 Bytes

Contents

# This migration comes from spree (originally 20101026184855)
class RemoveShippedState < ActiveRecord::Migration
  def up
    execute "UPDATE orders SET state = 'complete' WHERE state = 'shipped'"
    shipments = select_all "SELECT shipments.id FROM shipments WHERE order_id IN (SELECT orders.id FROM orders WHERE orders.state = 'shipped')"
    shipments.each do |shipment|
      execute "UPDATE shipments SET state='shipped' WHERE id = #{shipment[:id]}"
    end
  end

  def down
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
spree_mercado_pago_payment_method-0.0.2 spec/dummy/db/migrate/20121121030205_remove_shipped_state.spree.rb
spree_mercado_pago_payment_method-0.1.1 spec/dummy/db/migrate/20121121030205_remove_shipped_state.spree.rb
spree_mercado_pago_payment_method-0.1.0 spec/dummy/db/migrate/20121121030205_remove_shipped_state.spree.rb
datashift_spree-0.3.0 spec/sandbox/db/migrate/20121023154424_remove_shipped_state.spree.rb
datashift_spree-0.2.1 spec/sandbox/db/migrate/20121015151217_remove_shipped_state.spree.rb
datashift_spree-0.2.0 spec/sandbox/db/migrate/20120925192785_remove_shipped_state.spree.rb
datashift_spree-0.1.0 spec/sandbox/db/migrate/20120918081516_remove_shipped_state.spree.rb