Sha256: 1d543d961550ccb05399354d3d9a507df7261219d8ed98d38499ce32882488f5

Contents?: true

Size: 472 Bytes

Versions: 13

Compression:

Stored size: 472 Bytes

Contents

class AddEmailToOrder < ActiveRecord::Migration
  def self.up        
    change_table :orders do |t|
      t.string :email
    end       
    Order.reset_column_information
    # update legacy orders
    Order.find(:all, :include => :user, :conditions => "checkout_complete IS NOT NULL").each do |order|
      order.email = order.user.email
      order.save
    end
  end

  def self.down      
    change_table :orders do |t|
      t.remove :email
    end    
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
kdmny-spree-0.0.1 db/migrate/20090402200317_add_email_to_order.rb
spree-enriquez-0.9.4 db/migrate/20090402200317_add_email_to_order.rb
spree-0.9.4 db/migrate/20090402200317_add_email_to_order.rb
spree-0.9.3 db/migrate/20090402200317_add_email_to_order.rb
spree-0.9.2 db/migrate/20090402200317_add_email_to_order.rb
spree-0.9.1 db/migrate/20090402200317_add_email_to_order.rb
spree-0.9.0 db/migrate/20090402200317_add_email_to_order.rb
spree-0.8.4 db/migrate/20090402200317_add_email_to_order.rb
spree-0.8.5 db/migrate/20090402200317_add_email_to_order.rb
spree-0.8.0 db/migrate/20090402200317_add_email_to_order.rb
spree-0.8.1 db/migrate/20090402200317_add_email_to_order.rb
spree-0.8.2 db/migrate/20090402200317_add_email_to_order.rb
spree-0.8.3 db/migrate/20090402200317_add_email_to_order.rb