Using the JSON column type in mysql

It would appear the json data type is an unrecognised column type when using mysql, except mysql 5.7+ does has a native json data type. I'm going to assume that the root of the problem lies in this file: https://github.com/phalcon/cphalcon/blob/master/phalcon/db/dialect/mysql.zep#L197

The line shows the error that is thrown. I also assume it's just a simple case of adding a case statement to handle json, so I've forked and submitted a pr for version 3.2 - https://github.com/phalcon/cphalcon/pull/12984

Also, I would have thought that instead of showing this error, the fallback would have been to map to a text column instead?

Phalcon is abstracting away the differences in DBs, which means that dialect specific (mysql json columns for eg.) features are not available. You would have to implement your own dialect class.

But he posted mysql dialect class :D

Apparently 3.2 is a bug-only fix, so it has to go to 4.0. Seems a bit harsh but fair enough.

Tip: today when we work with MariaDB 10.2 which natively support text column type with JSON strings stored as text, this might not be needed, but it's wise to have it for sure.