mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
[Bug][MySQL] Invalid query when creating a Json column with deafult value #7311
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @valentimarco on GitHub (Feb 6, 2024).
Bug Report
Summary
I have a mysql@8.0.21 and i cannot set a JSON default value on one column.
Current behavior
From the entity below, i cannot setup correctly the default value of the column when is declare as json.
Further investigation discover that the orm does an invalid query to mysql:
CREATE TABLE setting (id INT AUTO_INCREMENT NOT NULL, settings JSON DEFAULT ('{}') NOT NULL, PRIMARY KEY(id))CREATE TABLE setting (id INT AUTO_INCREMENT NOT NULL, settings JSON DEFAULT '(''{}'')' NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDBmysql docs
How to reproduce
setting.php
composer.json
Pipeline to inizialize the database
Expected behavior
I aspect to have the column of type json with the default json. I can resolve the problem by using migration but is not scalable...