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
Unknown enum database type in migration file / Doctrine issue #1346
Comments
Was there ever an elegant solution to this found rather than modifying MySqlSchemaManager.php file? |
I ran into a similar issue with a legacy database that uses enum. I think I found a way to register the enum type and I put this in start/global.php but it is not working. $platform = DB::getDoctrineSchemaManager()->getDatabasePlatform();
$platform->registerDoctrineTypeMapping('enum', 'string');
$platform = DB::getDoctrineConnection()->getDatabasePlatform();
$platform->registerDoctrineTypeMapping('enum', 'string'); Anybody gotten this to work? |
Maybe this could help you out: #1186 (comment) |
👍 Good work |
Set the engine to InnoDb:
|
I am using laravel 5.2 but it still not working. Any help is much appreciated. |
Yes. It worked for me. |
To do this in Laravel 7 you can create a file <?php
namespace App\Providers;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\ServiceProvider;
class EnumServiceProvider extends ServiceProvider {
public function boot() {
// see https://github.com/laravel/framework/issues/1346
$platform = DB::getDoctrineSchemaManager()->getDatabasePlatform();
$platform->registerDoctrineTypeMapping('enum', 'string');
$platform = DB::getDoctrineConnection()->getDatabasePlatform();
$platform->registerDoctrineTypeMapping('enum', 'string');
}
} and then add |
This works on Laravel 6 too. |
This solution fixes the enum issue with filament |
I used an enum database type and when i run
php artisan migration
, i got this errorThere's a solution to register the enum like this
$platform->registerDoctrineTypeMapping('enum', 'string');
here http://wildlyinaccurate.com/doctrine-2-resolving-unknown-database-type-enum-requested but I wonder where to put that in Illuminate.I tried to put that in Doctrine/DBAL/Schema/MySqlSchemaManager.php and it worked. Is there a better solution?
The text was updated successfully, but these errors were encountered: