Skip to content

Comments

Fix column collation not applied for uuid type#1025

Open
dereuromark wants to merge 1 commit into4.xfrom
fix/uuid-collation-workaround
Open

Fix column collation not applied for uuid type#1025
dereuromark wants to merge 1 commit into4.xfrom
fix/uuid-collation-workaround

Conversation

@dereuromark
Copy link
Member

Summary

  • Fixes column collation not being applied for uuid type columns in createTable()
  • Converts uuid to char with length 36 in mapColumnData() so the dialect properly handles collation

This is a workaround for the issue reported in #1020. The root cause is that MysqlSchemaDialect::columnDefinitionSql() in cakephp/database only adds COLLATE for text, char, and string types. Since uuid columns generate CHAR(36) SQL but use the uuid type identifier, collation was being ignored.

A proper fix will be proposed to cakephp/cakephp to add uuid to the $hasCollate array in the dialect.

Closes #1020

The MysqlSchemaDialect in cakephp/database only adds COLLATE for
text, char, and string types. Since uuid columns generate CHAR(36)
but use the 'uuid' type identifier, collation was being ignored.

This fix converts uuid to char(36) in mapColumnData() so the dialect
properly handles the collation.

Fixes the issue reported in #1020.
Copy link
Member

@markstory markstory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me.

@dereuromark dereuromark marked this pull request as ready for review February 21, 2026 08:15
@dereuromark dereuromark requested a review from ADmad February 21, 2026 08:15
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.

2 participants