Sha256: 702f11f1d1680d9e5a6ea3894d85447cfae60631ab5e959e6f8098ff659d27f6
Contents?: true
Size: 746 Bytes
Versions: 20
Compression:
Stored size: 746 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 begin 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 remove_column :shop_addresses, :addressable_integer rescue # Yay sqlite end end def self.down # no reverse end end
Version data entries
20 entries across 20 versions & 1 rubygems