> Hi!
> Some weeks ago we discussed creation of custom Types [1] like the MySQL
> enum [2] and custom field modifiers like "UNSIGNED" [3]
> 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)")
> */
> public $name;
> 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",
> columnDefinition="enum('business', 'private')")
> */
> public $type;
> 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
> @GeneratedValue(strategy="AUTO")
> generate "SMALLINT PRIMARY KEY AUTOINCREMENT" or just "SMALLINT"?
> (Currently this breaks the patch, I'll change this)
> What do you think?
> Nico
> [1]
> http://groups.google.com/group/doctrine-user/browse_thread/thread/a3e...
> [2] http://www.doctrine-project.org/jira/browse/DDC-65
> [3]
> http://groups.google.com/group/doctrine-user/browse_thread/thread/6e0...
> --
> You received this message because you are subscribed to the Google Groups "doctrine-user" group.
> To post to this group, send email to doctrine-user@googlegroups.com.
> To unsubscribe from this group, send email to doctrine-user+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/doctrine-user?hl=en.