Closed romanpravda closed 1 year ago
Merging #121 (e2983d3) into 2.x (3d5cb74) will not change coverage. The diff coverage is
100.00%
.
@@ Coverage Diff @@
## 2.x #121 +/- ##
=========================================
Coverage 94.68% 94.68%
Complexity 1667 1667
=========================================
Files 96 96
Lines 4496 4496
=========================================
Hits 4257 4257
Misses 239 239
Impacted Files | Coverage Δ | |
---|---|---|
src/Driver/MySQL/Schema/MySQLColumn.php | 94.38% <ø> (ø) |
|
src/Driver/MySQL/MySQLHandler.php | 94.11% <100.00%> (ø) |
Thanks
Hi @roxblnfk,
I am having a trouble with JSON field and MariaDB while working with migrations. The problem is that in MariaDB the JSON datatype is an alias to longText with a check constraint to validate a json. This results in a behavior where GenerateMigrations
generator does not correctly map the database field (which has a longText type) to JSON and resulting migrations always try to change the column type to JSON.
I know MariaDB is not a supported DBMS, but MariaDB and MySQL are quite compatible and this is one of the rare incompatibilities. I would like to ask whether there is some simple solution so that the longText column is correctly identified as a json.
Thank you.
@peldax you can add readonlySchema: true
to ignore the column in migration generation process
https://github.com/cycle/annotated/blob/7dad356336ee70ef1f6e7b750274d4d215a691f1/src/Annotation/Column.php#L69
I think it also will work if you set column type to longText and add typecast: "json"
I think it also will work if you set column type to longText and add
typecast: "json"
This is great! Thanks.
Issue: https://github.com/cycle/database/issues/39
Adding support of JSON data type for MySQL driver since MySQL 5.7 and 8.0 supports this data type.