Default type for 'value' field is now 'clob' (mysql 'longtext')

167 views
Skip to first unread message

Tom Boutell

unread,
Dec 19, 2009, 1:46:40 PM12/19/09
to pkcontextcms
I just noticed that Doctrine's 'string' type maps to a MySQL 'text',
which is limited to 65,535 characters. That will be too short for
longer rich text documents, and perhaps other things you might want to
serialize() into the 'value' field. So I have changed it to a Doctrine
'clob', which maps to a MySQL 'longtext' (with a 4GB limit).

(Note that MySQL's protocol limits would probably kick in before the
4GB limit, but you can definitely move things much bigger than 65,536
bytes in a MySQL 5.x INSERT statement.)

This change has no backwards compatibility impact (at least in MySQL)
because the database queries generated to manipulate a CLOB are
exactly the same. That means your existing database will work 100%
with no modifications with code generated from this new schema.

To take advantage of the higher limit in your existing databases,
you'll want to alter your table:

ALTER TABLE pk_context_cms_slot MODIFY value LONGTEXT;

I may come up with a handy task to do this for you at some point using
the Doctrine migration API but in the meantime it's one line of MySQL
to lift the limit.

Reply all
Reply to author
Forward
0 new messages