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

Schema migration doesn't detect index length change #3414

Closed
morozov opened this issue Dec 18, 2018 · 2 comments
Closed

Schema migration doesn't detect index length change #3414

morozov opened this issue Dec 18, 2018 · 2 comments

Comments

@morozov
Copy link
Member

morozov commented Dec 18, 2018

Originally reported by @leofeyer in #3409 (comment).

Q A
BC Break no
Version 2.9.1
public function testUpdatesIndexLength()
{
    $this->connection->exec('CREATE TABLE index_length (path text NULL)');
    $this->connection->exec('CREATE INDEX path ON index_length (path(333))');

    $table = new Table('index_length');
    $table->addColumn('path', 'text', ['notnull' => false]);
    $table->addIndex(['path'], 'path', [], ['lengths' => [768]]);

    $fromSchema = $this->connection->getSchemaManager()->createSchema();
    $toSchema = new Schema([$table]);

    $diff = $fromSchema->getMigrateToSql($toSchema, $this->connection->getDatabasePlatform());

    self::assertContains('ALTER TABLE index_length DROP INDEX path, ADD INDEX path (path(768))', $diff);
}
@yvoyer
Copy link

yvoyer commented Feb 14, 2019

This fix seems to introduce another regression, see #3458

BourotBenjamin added a commit to BourotBenjamin/dbal that referenced this issue May 21, 2019
Release v2.9.2

[![Build Status](https://travis-ci.org/doctrine/dbal.svg?branch=v2.9.2)](https://travis-ci.org/doctrine/dbal)

This release fixes regressions introduced in v2.9.1.

- Total issues resolved: **2**

**MySQL, Schema Introspection:**

 - [3410: MySqlSchemaManager::parseCreateOptions() must be of the type string, null given](doctrine#3410) thanks to @jarnovanleeuwen and @morozov

**MySQL, Schema Comparison:**

 - [3414: Schema migration doesn't detect index length change](doctrine#3414) thanks to @leofeyer and @morozov
MKodde added a commit to OpenConext/OpenConext-engineblock that referenced this issue Feb 26, 2020
As of doctrine version 2.9.2 a schema comparison change was introduced
where index length changes where detected. This change caused the
`service_provider_entity_id` index to be notified as a changed column.
The correct column lenght was not set, resulting in recurring migration
creations.

The problem was resolved by setting the expected index lenth explicitly
on the index definition.

Relates to:
Pivotal ticket: https://www.pivotaltracker.com/story/show/169118938
Introduction of issue: doctrine/dbal#3414
The golden tip: doctrine/dbal#3458
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants