Skip to content

Fix phantom schema diff for an index prefix length equal to the column length - #7505

Open
Amoifr wants to merge 1 commit into
doctrine:4.4.xfrom
Amoifr:fix-5989-mysql-index-prefix-length
Open

Amoifr wants to merge 1 commit into
doctrine:4.4.xfrom
Amoifr:fix-5989-mysql-index-prefix-length

Conversation

@Amoifr

@Amoifr Amoifr commented Aug 24, 2026

Copy link
Copy Markdown

Fixes #5989.

MySQL and MariaDB silently drop an index prefix length that equals the indexed column's length (KEY idx (col(20)) on a VARCHAR(20) comes back as KEY idx (col)), so a table declared with such a length keeps producing a drop/create diff against its introspected version, forever. Following the direction discussed in #5976, the MySQL Comparator now anticipates this during normalization: a prefix length equal to the column's length is treated as no length. Effective prefixes (shorter than the column) are untouched, composite indexes only lose the lengths that MySQL would drop, and primary keys are left as is. Same normalization family as the recent float-default phantom-diff fix.

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

Successfully merging this pull request may close these issues.

Index with length equal to column length keeps generating diff

1 participant