> Doesn't mysql limit varchar to 65kb or so? >From mysql doc: "Values in VARCHAR columns are variable-length strings. The length can be specified as 1 to 255 before MySQL 4.0.2, 0 to 255 as of MySQL 4.0.2, and 0 to 65,535 as of MySQL 5.0.3. (The maximum actual length of a VARCHAR in MySQL 5.0 is determined by the maximum row size and the character set you use. The maximum effective length is 65,532 bytes.) "
That was the problem I was trying to get over - I found the :LONGTEXT workaround at 10 at night after 14 hour day so very well could be a better solution, but I do remember specifically that I was being cut off at ~65k chars. I don't recall trying varchar... but looks like at least in my case would not have worked. On Fri, Aug 13, 2010 at 3:03 PM, Philip Hallstrom <[email protected]> wrote: >>>> Conor, >>>> I think this is relevant - I had similar issue when I was saving reports >>>> to >>>> a db field. To work around, I changed the datatype of the field to >>>> :longtext. You can create or change the field to :longtext in your >>>> migration >>>> and everyone should be happy. >>> >>> Hi David, >>> >>> >>> Thanks a million for your reply. I will give that a go. I had seen that >>> that is possible but I was a bit worried that it would mean that my >>> migrations wouldn't be database agnostic >> >> Is there a reason that you're not using VARCHAR? That should hold the >> data (in less space, I believe!) and keep your migrations DB-agnostic. > > Doesn't mysql limit varchar to 65kb or so? > > http://dev.mysql.com/doc/refman/5.1/en/char.html > > Not very pretty, but you could create it as :text and then... > > if connection.adapter_name == 'MySQL' > execute("ALTER TABLE tablename MODIFY fieldname MEDIUMTEXT") > end > > That keeps it a bit more db-agnostic. > > -philip > > -- > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

