Sha256: 2f3e23247c51a7359140341982634f7231f5a1a784ff0103a8b5269ef11bfc20

Contents?: true

Size: 358 Bytes

Versions: 35

Compression:

Stored size: 358 Bytes

Contents

class PopulateLegacyShipmentState < ActiveRecord::Migration
  def up
    shipments = select_all "SELECT * FROM shipments"
    shipments.each do |shipment|
      if shipment['shipped_at']
        execute "UPDATE shipments SET state = 'shipped'"
      else
        execute "UPDATE shipments SET state = 'pending'"
      end
    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/20091214183826_populate_legacy_shipment_state.rb
spree_core-1.1.6 db/migrate/20091214183826_populate_legacy_shipment_state.rb
spree_core-1.1.5 db/migrate/20091214183826_populate_legacy_shipment_state.rb
spree_core-1.2.4 db/migrate/20091214183826_populate_legacy_shipment_state.rb
spree_core-1.0.7 db/migrate/20091214183826_populate_legacy_shipment_state.rb
spree_core-1.2.3 db/migrate/20091214183826_populate_legacy_shipment_state.rb
spree_core-1.2.2 db/migrate/20091214183826_populate_legacy_shipment_state.rb
spree_core-1.1.4 db/migrate/20091214183826_populate_legacy_shipment_state.rb
spree_core-1.2.0 db/migrate/20091214183826_populate_legacy_shipment_state.rb
spree_core-1.2.0.rc2 db/migrate/20091214183826_populate_legacy_shipment_state.rb
spree_core-1.2.0.rc1 db/migrate/20091214183826_populate_legacy_shipment_state.rb
spree_core-1.1.3 db/migrate/20091214183826_populate_legacy_shipment_state.rb
spree_core-1.0.6 db/migrate/20091214183826_populate_legacy_shipment_state.rb
spree_pag_seguro-1.0.7 spec/dummy/db/migrate/20120301154068_populate_legacy_shipment_state.rb
spree_core-1.1.2 db/migrate/20091214183826_populate_legacy_shipment_state.rb
spree_core-1.1.2.rc1 db/migrate/20091214183826_populate_legacy_shipment_state.rb
spree_pag_seguro-1.0.6 spec/dummy/db/migrate/20120301154068_populate_legacy_shipment_state.rb
spree_pag_seguro-1.0.5 spec/dummy/db/migrate/20120301154068_populate_legacy_shipment_state.rb
spree_pag_seguro-1.0.4 spec/dummy/db/migrate/20120301154068_populate_legacy_shipment_state.rb
spree_core-1.1.1 db/migrate/20091214183826_populate_legacy_shipment_state.rb