Sha256: c601685770fafd7e32a62af6f4d5618e31697d6dd6dbafcb40f6c775da64bc33

Contents?: true

Size: 616 Bytes

Versions: 2

Compression:

Stored size: 616 Bytes

Contents

class FixAddressableColumnType < ActiveRecord::Migration
  def self.up
    add_column :shop_addresses, :addressable_integer, :integer
    ShopAddress.reset_column_information
    ShopAddress.find_each do |address|
      address.update_attribute(:addressable_integer, :addressable_id)
    end
    remove_column :shop_addresses, :addressable_id
    
    add_column :shop_addresses, :addressable_id, :integer
    ShopAddress.reset_column_information
    ShopAddress.find_each do |address|
      address.update_attribute(:addressable_id, :addressable_integer)
    end  
  end

  def self.down
    # no reverse
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
radiant-shop-extension-0.92.2 db/migrate/20101214023052_fix_addressable_column_type.rb
radiant-shop-extension-0.92.1 db/migrate/20101214023052_fix_addressable_column_type.rb