dbal
dbal copied to clipboard
Versionable datetimetype column diff issue
Bug Report
Q | A |
---|---|
Version | 3.3.2 |
Summary
Platform: MySQL Version: 8.0
Entity with versionable field:
/**
* @ORM\Version()
* @ORM\Column(type="datetime")
*/
private \DateTime $version;
generates the same migration over and over again even after executing it (https://github.com/rmikalkenas/migration-issue/blob/version-issue/migrations/Version20220302083650.php)
An issue comes from changes that adds Comparator
with provided database platform as dependency.
When comparing columns this peace of code https://github.com/doctrine/dbal/blob/baf6efed70e46f4d979e5dd42f804007e75f12fb/src/Schema/Comparator.php#L291 returns []
on versionable datetimetype column. But due to set $this->platform
later check $this->columnsEqual($column, $toColumn)
results to false
and marks column as having changes. Because one of Column
instances does not have version
platform option which is necessary for getting correct mysql datetime column type declaration: https://github.com/doctrine/dbal/blob/baf6efed70e46f4d979e5dd42f804007e75f12fb/src/Platforms/AbstractMySQLPlatform.php#L249
How to reproduce
https://github.com/rmikalkenas/migration-issue/tree/version-issue
version-issue
branch
Expected behaviour
No migration should be generated for versionable datetime type column
Any update on this? Pointers or suggestions for potentially providing a fix?