On Aug 17, 2011, at 7:38 PM, Philip Hallstrom wrote:


On Aug 17, 2011, at 3:32 PM, John Hinnegan wrote:

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?

Or just...

change_column :my_table, :related_data, :text, :limit => 123456789 # or whatever you think is large enough

-philip


I think that the limit can be 2048 as I recall that is the max for a URL. I can't find a reference to back that up at the moment, but I think that this is what the sitemap specification (see Google) allows, too.

-Rob

Rob Biedenharn          
r...@agileconsultingllc.com     http://AgileConsultingLLC.com/
r...@gaslightsoftware.com               http://GaslightSoftware.com/

--
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Talk" group.
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