Open
Description
Bug Report
Q | A |
---|---|
Version | 3.6.1 |
Summary
Reported by @janedbal in #5976.
When specifying a prefix index in MySQL with a prefix length matching the actual VARCHAR
column length, DBAL's comparator will keep detecting changes to the deployed table.
Current behaviour
See the analysis in #5976 (comment).
Summary: MySQL silently drops the prefix from such an index definition.
How to reproduce
See #5976 for a failing test.
Create this table, deploy it to MySQL or MariaDB, intropect the newly created table and have the comparator compare it to your initial definition.
$table = new Table('my_table');
$table->addColumn('my_col', 'string', ['length' => 20]);
$table->addIndex(['my_col'], 'idx_col', [], ['lengths' => [20]]);
Expected behaviour
The table declared above should be considered equal to its deployed version.
Workaround
The issue can be worked around by not specifying a prefix length for the affected column.