Sha256: be95270401e7f5c80475270c434f5d8ec63c381cfb58fbe9b46532929a9eb2c9
Contents?: true
Size: 726 Bytes
Versions: 7
Compression:
Stored size: 726 Bytes
Contents
# This migration comes from spree (originally 20100105132138) class ShipmentIdForInventoryUnits < ActiveRecord::Migration def up add_column :inventory_units, :shipment_id, :integer add_index :inventory_units, :shipment_id # migrate legacy shipments Spree::Shipment.table_name = 'shipments' Spree::Shipment.all.each do |shipment| unless shipment.order puts "Warning: shipment has invalid order - #{shipment.id}" next end shipment.order.inventory_units.each do |unit| unit.update_column('shipment_id', shipment.id) end end Spree::Shipment.table_name = 'spree_shipments' end def down remove_column :inventory_units, :shipment_id end end
Version data entries
7 entries across 7 versions & 2 rubygems