Sha256: 7659f0ec52a6bdcfce0bd21c90c11a70c00bffa212446d6c8e7efbe2da7de43e

Contents?: true

Size: 429 Bytes

Versions: 35

Compression:

Stored size: 429 Bytes

Contents

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

35 entries across 35 versions & 3 rubygems

Version Path
spree_core-1.2.5 db/migrate/20101026184855_remove_shipped_state.rb
spree_core-1.1.6 db/migrate/20101026184855_remove_shipped_state.rb
spree_core-1.1.5 db/migrate/20101026184855_remove_shipped_state.rb
spree_core-1.2.4 db/migrate/20101026184855_remove_shipped_state.rb
spree_core-1.0.7 db/migrate/20101026184855_remove_shipped_state.rb
spree_core-1.2.3 db/migrate/20101026184855_remove_shipped_state.rb
spree_core-1.2.2 db/migrate/20101026184855_remove_shipped_state.rb
spree_core-1.1.4 db/migrate/20101026184855_remove_shipped_state.rb
spree_core-1.2.0 db/migrate/20101026184855_remove_shipped_state.rb
spree_core-1.2.0.rc2 db/migrate/20101026184855_remove_shipped_state.rb
spree_core-1.2.0.rc1 db/migrate/20101026184855_remove_shipped_state.rb
spree_core-1.1.3 db/migrate/20101026184855_remove_shipped_state.rb
spree_core-1.0.6 db/migrate/20101026184855_remove_shipped_state.rb
spree_pag_seguro-1.0.7 spec/dummy/db/migrate/20120301154118_remove_shipped_state.rb
spree_core-1.1.2 db/migrate/20101026184855_remove_shipped_state.rb
spree_core-1.1.2.rc1 db/migrate/20101026184855_remove_shipped_state.rb
spree_pag_seguro-1.0.6 spec/dummy/db/migrate/20120301154118_remove_shipped_state.rb
spree_pag_seguro-1.0.5 spec/dummy/db/migrate/20120301154118_remove_shipped_state.rb
spree_pag_seguro-1.0.4 spec/dummy/db/migrate/20120301154118_remove_shipped_state.rb
spree_core-1.1.1 db/migrate/20101026184855_remove_shipped_state.rb