Handle MySQL enum types in an existing DB schema

This commit is contained in:
Jeremy Dormitzer 2019-03-02 14:31:27 -05:00
parent 18ba59e4dd
commit 6d4e3391f4

View File

@ -102,6 +102,12 @@ class ActivityPub
public function updateSchema()
{
$entityManager = @$this->module->get( EntityManager::class );
$driverName = $entityManager->getConnection()->getDriver()->getName();
if ( $driverName === 'pdo_mysql' )
{
$entityManager->getConnection()->getDatabasePlatform()
->registerDoctrineTypeMapping('enum', 'string');
}
$schemaTool = new SchemaTool( $entityManager );
$classes = $entityManager->getMetadataFactory()->getAllMetadata();
$schemaTool->updateSchema( $classes, true );