Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem generating model helpers, as database has MySQL 5.7 JSON/JSONB column types #295

Closed
ghost opened this issue Dec 23, 2015 · 9 comments

Comments

@ghost
Copy link

ghost commented Dec 23, 2015

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.

@mstralka
Copy link

@ddctd143 Did you figure out a solution for this?

@mstralka
Copy link

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...

doctrine/dbal#2266

@rmff
Copy link

rmff commented Feb 22, 2016

I'm with same issue, anyone knows a way to ignore this error and generate ide-helper:model ?

@tankerkiller125
Copy link

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.

@hauthorn
Copy link

Has this been fixed? I'm getting the same error message using Laravel 5.2, Mysql 5.7.13 and php 7.0.*

@ghost
Copy link
Author

ghost commented Jul 31, 2016

No.
It will be fixed when this doctrine/dbal#2266 PR gets merged into doctrine/dbal main branch.

@i906
Copy link

i906 commented Dec 8, 2016

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
 */

@blackfyre
Copy link

Actually

'custom_db_types' => array(
        'mysql'=> [
            'json'=>'json_array'
        ]
    ),

works just as well 😄

@mfn
Copy link
Collaborator

mfn commented Jun 25, 2020

@barryvdh the correct solution is the last comment (to use custom_db_types), IMHO issue can be closed :}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants