Skip to content

Instantly share code, notes, and snippets.

@nuryagdym
Created July 20, 2020 11:05
Show Gist options
  • Save nuryagdym/27378a7debe45897b9340b8fecd08253 to your computer and use it in GitHub Desktop.
Save nuryagdym/27378a7debe45897b9340b8fecd08253 to your computer and use it in GitHub Desktop.
Doctrine 2.x "Unknown database type enum, MySQL57Platform may not support it" fix
<?php
/**
* Symfony 4.4 migration file.
* add this file to src/migrations/ directory.
* github issue: https://github.com/doctrine/dbal/issues/3161
*/
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
use Doctrine\Migrations\Version\Version;
final class Version20200508000000 extends AbstractMigration
{
public function __construct(Version $version)
{
parent::__construct($version);
/**
* this lines solves error, solution provided by @sgilberg .
* You don't have to add this line to every migration file.
* Single migration file containing this line solves the error.
*/
$this->connection->getSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
}
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment