Sha256: 371b05b60d1d35bd092df98f080a98780f44bd0fa2c9afd5830e0d92f78312e9

Contents?: true

Size: 630 Bytes

Versions: 6

Compression:

Stored size: 630 Bytes

Contents

class CreateCalculators < ActiveRecord::Migration
  def self.up
    create_table :calculators do |t|
      t.string :type
      t.references :calculable, :polymorphic => true, :null => false
      t.timestamps
    end          
    change_table :shipping_methods do |t|
      t.remove :shipping_calculator
    end                                        
    ShippingMethod.all.each do |shipping_method|  
      Calculator::FlatRate.create(:calculable => shipping_method)
    end    
  end

  def self.down
    drop_table :calculators
    change_table :shipping_methods do |t|
      t.string :shipping_calculator
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
spree-enriquez-0.9.4 db/migrate/20090715172345_create_calculators.rb
spree-0.9.4 db/migrate/20090715172345_create_calculators.rb
spree-0.9.3 db/migrate/20090715172345_create_calculators.rb
spree-0.9.2 db/migrate/20090715172345_create_calculators.rb
spree-0.9.1 db/migrate/20090715172345_create_calculators.rb
spree-0.9.0 db/migrate/20090715172345_create_calculators.rb