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

BLOB, TEXT, GEOMETRY or JSON column '<name>' can't have a default value #1344

Open
malc0mn opened this issue Jul 26, 2023 · 0 comments
Open

Comments

@malc0mn
Copy link

malc0mn commented Jul 26, 2023

Bug Report

Q A
BC Break no (actually not sure)
Version 3.6.0

Summary

When setting a default value to a property mapped as json, the migration created on MySQL 8.0.33 will be faulty. The default value for BLOB, TEXT, GEOMETRY or JSON must be written as an expression, see https://dev.mysql.com/doc/refman/8.0/en/data-type-defaults.html section Explicit Default Handling as of MySQL 8.0.13

Current behavior

Generated migration with a mapping of json and default value of '[]' generates this migration:

[...] my_column_name JSON DEFAULT \'[]\' NOT NULL [...]

How to reproduce

Simply create a mapping of type json with default value '[]' and generate a migration.

Expected behavior

Generated migration with a mapping of json and default value of '[]' should generate this migration (note the added parenthesis):

[...] my_column_name JSON DEFAULT (\'[]\') NOT NULL [...]
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

No branches or pull requests

1 participant