Jira issue originally created by user vbence:
I have found a previous issue, http://www.doctrine-project.org/jira/browse/DBAL-1085 which tells about the need to override "requiresSQLCommentHint" if the custom type uses an SQL type which is already known by Doctrine.
See also:
https://github.com/doctrine/dbal/blob/bfee907d3c346ab759d48f37bffcab78ede1c17f/lib/Doctrine/DBAL/Types/Type.php#L327-L340
The bug: After I learned this and added the required TRUE return value, the migration (generated by "diff") won't contain the comment.
After adding the comment manually, everything works as expected.
I can confirm this is an issue. Changing a field's type from integer to money (custom type that extends integer, and returns true for requiresSQLCommentHint) should have created a comment on doctrine:schema:update --dump-sql, but it doesn't:
current output:
ALTER TABLE foobar ALTER fruit TYPE INT
ALTER TABLE foobar ALTER fruit DROP DEFAULT
expected output:
ALTER TABLE foobar ALTER fruit TYPE INT
ALTER TABLE foobar ALTER fruit DROP DEFAULT
COMMENT ON COLUMN foobar.fruit IS '(DC2Type:money)'
Oh and we are using postgresql, but I'm pretty sure it affects other drivers too. Hope this helps!
Hi, I have similar issue. I add CITEXT type mapping (on PostgreSQL), and in each migration I have:
//migration
$this->addSql('ALTER TABLE managers ALTER email TYPE CITEXT');
$this->addSql('ALTER TABLE managers ALTER email DROP DEFAULT');
$this->addSql('ALTER TABLE managers ALTER email TYPE CITEXT');
//CitextType
public function requiresSQLCommentHint(AbstractPlatform $platform)
{
return $platform->getName() !== 'postgresql'; // I also tries to return true - no effect
}
Even if previously successfully migration contain the same queries.
Most helpful comment
I can confirm this is an issue. Changing a field's type from
integertomoney(custom type that extends integer, and returnstrueforrequiresSQLCommentHint) should have created a comment ondoctrine:schema:update --dump-sql, but it doesn't:current output:
expected output:
Oh and we are using postgresql, but I'm pretty sure it affects other drivers too. Hope this helps!