php artisan ide-helper:models
Exception: Unknown database type json requested, Doctrine\DBAL\Platforms\MySqlPlatform may not support it.
I have upgraded to Laravle 5.2 to use Schema builder with $table->json(...) ability.
DBAL from version 2.5 has support for new json field types in Doctrine\DBAL\Platforms\MySQL57Platform class which extends default MySqlPlatform class.
@ddctd143 Did you figure out a solution for this?
I found this pull request on DBAL, which indicates that MySQL 5.7.8 is the specific version that JSON became available in, but the PR has not been merged yet, so this might be an upstream problem that we have to wait for...
I'm with same issue, anyone knows a way to ignore this error and generate ide-helper:model ?
Couldn't in theory require our own version of dbal with that pull request merged? And then set the repo in the composer.json of this lib? So far in my testing dbal with that pull request seems to work fine.
Has this been fixed? I'm getting the same error message using Laravel 5.2, Mysql 5.7.13 and php 7.0.*
No.
It will be fixed when this https://github.com/doctrine/dbal/pull/2266 PR gets merged into doctrine/dbal main branch.
I have added the following in config/ide-helper.php and seemed to ignore the error:
'custom_db_types' => array(
'mysql' => [
'json' => 'text',
],
),
In _ide_helper_models.php, the json field come out as array:
/**
* @property array $data
*/
Actually
'custom_db_types' => array(
'mysql'=> [
'json'=>'json_array'
]
),
works just as well :smile:
@barryvdh the correct solution is the last comment (to use custom_db_types), IMHO issue can be closed :}
Most helpful comment
Actually
works just as well :smile: