Hey burada yazdığım bir göç oldukça iyi çalışıyor. Varchar (255) 'enclosureUrl' olan bir sütunda 'scraped_episodes' tablosu var. Bunu uzun URL'lere daha uzun yapmak zorundayım, bu yüzden kullandım (Rails 3.2.13)
class ExpandEnclosureUrl < ActiveRecord::Migration
def up
# remove index cuz we need to
remove_index :scraped_episodes, :enclosureUrl
# change length to 2048 characters
change_column :scraped_episodes, :enclosureUrl, :text, :limit=>2048
# redo this index to only index the first 255 chars
add_index :scraped_episodes, :enclosureUrl, :length => 255
end
def down
# remove index cuz we need to
remove_index :scraped_episodes, :enclosureUrl
# use the same settings at when i first created this field
change_column :scraped_episodes, :enclosureUrl, :string, :limit=>nil
# use the same settings as when i first added this index
add_index :scraped_episodes, :enclosureUrl
end
end