[DBAL-324] SchemaManager should first look into comment instead of infer the type first. Created: 17/Aug/12 Updated: 03/Jan/14
|Reporter:||Guilherme Blanco||Assignee:||Guilherme Blanco|
When using schema tool, Doctrine tries to infer the Doctrine type via the mapped types in Platform.
|Comment by Benjamin Eberlei [ 29/Aug/12 ]|
Why is this a bug? Can you say some more about why we need to do this and what error occurs?
|Comment by Guilherme Blanco [ 29/Aug/12 ]|
This issue is strictly correlated to the commit I've done here: https://github.com/doctrine/dbal/commit/e25c774dde971dc4afd40648e9ccd0af53b34ce9
Mainly, we may have legacy database that we do know how Doctrine should operate. Under this circumstance, we may want to add a comment to the field defining the Doctrine DBAL type.
That happens because MySQL Schema Manager (and others) first looks for the column type:
But if we first try to look for the commented data type:
|Comment by Steve Tauber [ 14/May/13 ]|
This also applies for a type of yaml.
/** @Column(type="yaml") */
./scripts/doctrine orm:schema-tool:update --dump-sql
Very frustrating.... Might be related to http://www.doctrine-project.org/jira/browse/DBAL-42
|Comment by Steve Müller [ 03/Jan/14 ]|
Steve Tauber You have defined a custom data type. You need to override `Type::requiresSQLCommentHint()` to return true in your custom data type, otherwise Doctrine cannot infer the custom type mapping from the column comment and the comparator will always detect changes between Yaml and LONGTEXT. This is not directly related to this issue here I think.