From 6d4e3391f4cacf7c7801ba8beb2cbb3f321fcab3 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Sat, 2 Mar 2019 14:31:27 -0500 Subject: [PATCH] Handle MySQL enum types in an existing DB schema --- src/ActivityPub.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ActivityPub.php b/src/ActivityPub.php index 5b0215c..b4b108f 100644 --- a/src/ActivityPub.php +++ b/src/ActivityPub.php @@ -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 );