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 [...]
Bug Report
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 sectionExplicit Default Handling as of MySQL 8.0.13
Current behavior
Generated migration with a mapping of
json
and default value of'[]'
generates this migration: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):