So I'm using a column in my database to serialize a hash of extra data about 
an object.  Stuff I'd want when displaying, but not anything else I care to 
have structured access to in my DB.  I recently started storing an URL in 
field, so I decided I'd better change the column type from string (which it 
probably should never have been) to text.  

I did so with a standard migration

def self.up
change_column :my_table, :related_data, :text 
end 

Looking in my schema.db file, I see:

   t.text     "related_data",         :limit => 255

I think I know how to fix it, but want some reinforcement I'm on the right 
track before I spend the time.  Looks like what I really need is:

def self.up
  add_column :my_table, :new_related_data, :text
  # copy data from related_data to new_related_data
  remove_column :my_table, :related_data
  rename_column :my_table, :new_related_data, :related_data
end 

yes?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/xpW-_gCnng8J.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to