NEW RELEASE: v0.20090605 fixes MySQL truncation

7 views
Skip to first unread message

Igal Koshevoy

unread,
Jun 5, 2009, 5:13:11 PM6/5/09
to openconferenceware
I've created a new stable release that's just v0.20090524 plus a
backported fix for MySQL truncation. This is a severe bug that we only
identified after migrating Open Source Bridge's OCW to MySQL the other
day. Thankfully we had complete backups and logs, so no data was lost.

This stable release does not contain user favorites or the new features
we've deployed to Open Source Bridge. These will be included in the next
stable release.

-igal

PS: Rails "string" columns are interpreted as "varchar(255)" on MySQL,
but as "text" on SQLite, and MySQL will cheerfully and silently truncate
your data. :(

###

From http://github.com/igal/openconferenceware/blob/master/CHANGES.txt

* v0.20090605

- FIXED schema/migrations for MySQL, it was truncating important columns
to 255 characters. This fix upgrades these "varchar(255)" columns to
"text": proposal descriptions, schedule items excerpts and
descriptions, snippets descriptions, and tracks descriptions. If you
were using SQLite, you were not affected by this bug.


Sam Goldstein

unread,
Jun 5, 2009, 9:46:16 PM6/5/09
to openconfe...@googlegroups.com
Igal,

Also, beware that MySQL limits the size of text columns and will silently truncate them.  I've run into this problem on projects that store very long strings in MySQL text fields (I think that the default limit may be around 65,000 char).  The fix is to add a limit option to your migration so MySQL increases the column size.

class IncreaseTextLength < ActiveRecord::Migration
  def self.up
    change_column :a_table, :column_name, :text, :limit => 1000000
  end

  def self.down
    change_column :a_table, :column_name, :text
  end
end

~Sam Goldstein
Reply all
Reply to author
Forward
0 new messages