Created
July 20, 2020 11:05
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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