Skip to content

support mysql8+ default values for text data types#7242

Open
paulmhh wants to merge 1 commit intodoctrine:3.10.xfrom
paulmhh:3.10.x
Open

support mysql8+ default values for text data types#7242
paulmhh wants to merge 1 commit intodoctrine:3.10.xfrom
paulmhh:3.10.x

Conversation

@paulmhh
Copy link
Copy Markdown

@paulmhh paulmhh commented Dec 4, 2025

mysql requires text type column defaults to be written as expressions
https://dev.mysql.com/doc/refman/8.0/en/data-type-defaults.html

=> correct mysql8+ syntax is:
DEFAULT ('text literal')

Q A
Type bug/improvement
Fixed issues NA

Summary

mysql8+ does support default values for text typed columns (text, blob, json, geometry)
doctrine disallows this and silently drops the default value

mysql requires text type column defaults to be written as expressions
https://dev.mysql.com/doc/refman/8.0/en/data-type-defaults.html

DEFAULT ('text literal')
@derrabus
Copy link
Copy Markdown
Member

derrabus commented Dec 4, 2025

Thank you. Please add tests.

@sbuerk
Copy link
Copy Markdown
Contributor

sbuerk commented Mar 1, 2026

Support of default values for these types has been introduced with MySQL 8.0.13 [1].

I just wanted to mention this, as this leaves a gap where this is not supported and would lead to errors.

Not sure if it would still be okay to add it that way. Special as the pull-request is addressed to go back into 3.10.x as bugfix.

@derrabus We added that to TYPO3 and the extended platforms, but required to also adopt the MySQLSchemaManager to normalize it again later on. If I remember right, that was due to the need that we kept the comparision based on the columns and not using the created colum sql check back then. Could be possible that we do not need that anymore as we dropped the old way and I guess it should not be required anymore. Just wanted to link it here https://review.typo3.org/c/Packages/TYPO3.CMS/+/83556

For TYPO3 we have raised lowest supported MySQL version to 8.0.17+ anyway and that was the reason why I (we) did not provided that upstream yet.

[1] https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-13.html#mysqld-8-0-13-data-types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants