Some weeks ago we discussed creation of custom Types  like the MySQL
enum  and custom field modifiers like "UNSIGNED" 
While in need for another custom type (char - for fixed length text)
that - like enum - can be mapped to a Doctrine StringType, I implemented
a "columnDefinition" element for @Column annonations.
According to the JPA specification the "columnDefinition" stands for
"The SQL fragment that is used when generating the DDL for the column".
It holds custom, most likely platform specific, column definitions for
Doctrine types, which are passed to the database as they are.
With the attached patch (for trunk Doctrine 2.0, r6895) you can do
something like this:
* @Column(name="name", type="string", columnDefinition="CHAR(32)")
In vanilla Doctrine 2.0 this column is created as STRING, but the
patched version generates a "CHAR(32)" database column (of course this
throws an exception if the DBM does not support "CHAR(32)".
You can easily map enums as well:
* @Column(name="type", type="string",
One question I did not find an answer for yet is, what exactly should be
passed to the DBM? This is especially interesting if there are
additional definitions (like PRIMARY KEY, NOT NULL, etc.).
Should this code:
@Column(name="id", type="integer", columnDefinition="SMALLINT") @Id
generate "SMALLINT PRIMARY KEY AUTOINCREMENT" or just "SMALLINT"?
(Currently this breaks the patch, I'll change this)
What do you think?