Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
w-ap-admin opened this issue Jan 12, 2023 · 1 comment

Comments

@w-ap-admin
Copy link

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;
    }
 ...
@greg0ire
Copy link
Member

Duplicate of doctrine/migrations#1302

@greg0ire greg0ire marked this as a duplicate of doctrine/migrations#1302 Jan 12, 2023
@greg0ire greg0ire closed this as not planned Won't fix, can't repro, duplicate, stale Jan 12, 2023
@greg0ire greg0ire pinned this issue Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants