doctrine/DoctrineMigrationsBundle

Bug: comparaison metadata of table `doctrine_migration_versions` fail with doctrine/orm": "^2.6.4

w-ap-admin opened this issue · 1 comments

There is a bug in the last released version of doctrine.

The bug come from the file lib/Doctrine/Migrations/Metadata/Storage/TableMetadataStorage.php.
The new function to compare the table doctrine_migration_versions is more strict than the previous one, which seems to be better.
And it now compares the _platformOptions from each column. Which was not the case before:
image

But the function getExpectedTable does not return the _platformOptions.
I don't know if it is the constructor of class Table which should have the responsiblity to get this options or if it's the role of getExpectedTable.

// src/Schema/Table.php
public function __construct(
        string $name,
        array $columns = [],
        array $indexes = [],
        array $uniqueConstraints = [],
        array $fkConstraints = [],
        array $options = []
    ) {
        if ($name === '') {
            throw InvalidTableName::new($name);
        }

        $this->_setName($name);

        foreach ($columns as $column) {
            $this->_addColumn($column);
        }

        foreach ($indexes as $idx) {
            $this->_addIndex($idx);
        }

        foreach ($uniqueConstraints as $uniqueConstraint) {
            $this->_addUniqueConstraint($uniqueConstraint);
        }

        foreach ($fkConstraints as $constraint) {
            $this->_addForeignKeyConstraint($constraint);
        }

        $this->_options = array_merge($this->_options, $options);
    }
// lib/Doctrine/Migrations/Metadata/Storage/TableMetadataStorage.php
...
private function getExpectedTable(): Table
    {
        $schemaChangelog = new Table($this->configuration->getTableName());

        $schemaChangelog->addColumn(
            $this->configuration->getVersionColumnName(),
            'string',
            ['notnull' => true, 'length' => $this->configuration->getVersionColumnLength()]
        );
        $schemaChangelog->addColumn($this->configuration->getExecutedAtColumnName(), 'datetime', ['notnull' => false]);
        $schemaChangelog->addColumn($this->configuration->getExecutionTimeColumnName(), 'integer', ['notnull' => false]);

        $schemaChangelog->setPrimaryKey([$this->configuration->getVersionColumnName()]);

        return $schemaChangelog;
    }
 ...