Skip to content

Versionable datetimetype column diff issue #5307

Open
@rmikalkenas

Description

@rmikalkenas

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

$changedProperties = $this->diffColumn($column, $toColumn);
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:
public function getDateTimeTypeDeclarationSQL(array $column)

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions