Unknown database type enum requested, Doctrine\DBAL\Platforms\MariaDb1027Platform may not support it.
tolgafiratoglu opened this issue · comments
Hello,
I have an enum in my table. So I added the following fix for the migration file. No problem in migration, but when I try to generate model using your library, I get an error.
Here's how I generate the model:
php artisan krlove:generate:model InteriorFeature --table-name=interior_feature
My fix for enum. By the help of this fix, I have no problem with migration:
public function __construct()
{
DB::getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
}
I am fetching same issue.
I get the same for mysql:
Unknown database type enum requested, Doctrine\DBAL\Platforms\MySQL57Platform may not support it.
Using this https://github.com/krlove/eloquent-model-generator#registring-custom-database-types and this
public function __construct() { DB::getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); }
Solved this issue for me
[Case in Laravel 7]
for fixed this issue, i create file with name eloquent_model_generator.php within config/ directory, and you just copy code below:
<?php
return [
'model_defaults' => [
// ...
'db_types' => [
'enum' => 'string',
],
],
];
gierg's answer solved my problem; but I need to underline I switched to L7 first.
gierg's answer solved my problem; but I need to underline I switched to L7 first.
I think this problem in all version, because in version 5+ i got this problem too.
#cmiiw
can this problem closed? if not, i'll follow for best answer for this problem
[Case in Laravel 7]
for fixed this issue, i create file with name eloquent_model_generator.php within config/ directory, and you just copy code below:<?php return [ 'model_defaults' => [ // ... 'db_types' => [ 'enum' => 'string', ], ], ];
Para los que hablen español, y no encuentren que onda, la respuesta de @gierg también jala en laravel 8, solo deben crear el archivo en la carpeta de config y poner lo que se indica
[Case in Laravel 7]
for fixed this issue, i create file with name eloquent_model_generator.php within config/ directory, and you just copy code below:<?php return [ 'model_defaults' => [ // ... 'db_types' => [ 'enum' => 'string', ], ], ];
its working. but models are not created inside Model directory. but not an issue!