On doctrine:schema:update every time alter table
anydasa opened this issue · comments
Please add to src/UuidType.php the code to avoid this problem
/**
* @param AbstractPlatform $platform
*
* @return array
*/
public function getMappedDatabaseTypes(AbstractPlatform $platform)
{
return [self::NAME];
}
I have same problem with postgres.
I'm sorry it's taken so long for me to respond to this. Can you provide more information so I can reproduce this? Thanks!
I'm trying to find examples in doctrine/dbal that use getMappedDatabaseTypes()
, and I can't find anything. Their GuidType
and StringType
do not implement this method, for example.
Hello, all !
Any updates about this issue ? Maybe someone can provide any advice?
@gansky-alexander, I need more information about the issue. Are you able to provide more information?
Hi, I have similar issue. My current packages (symfony 5.3):
"doctrine/doctrine-bundle": "^2.1",
"doctrine/doctrine-migrations-bundle": "^3.0",
"doctrine/orm": "^2.7",
"ramsey/uuid-doctrine": "^1.6"
When I run bin/console d:m:diff
each time alter table is added, but I always fix this with:
$this->addSql('COMMENT ON COLUMN my_table.id IS \'(DC2Type:uuid)\'');
It looks as if this comment has stopped adding itself since some update 🤔
I reproduced the issue after updating to 1.7 and postgres, I think is caused by the removal of \Ramsey\Uuid\Doctrine\UuidType::requiresSQLCommentHint
that is always needed for custom types, even if the platform support the type natively, otherwise doctrine cannot differentiate the custom type mapping to the native uuid type
so my suggestion would be to restore \Ramsey\Uuid\Doctrine\UuidType::requiresSQLCommentHint
, for reference its present also in symfony/doctrine-bridge for the uid types https://github.com/symfony/doctrine-bridge/blob/5.3/Types/AbstractUidType.php#L91