Details
Description
Dropping Entities with:
$tool = new \Doctrine\ORM\Tools\SchemaTool($em);
$classes = array(
$em->getClassMetadata('Entities\User'),
$em->getClassMetadata('Entities\Profile')
);
$tool->dropSchema($classes);
throws:
Doctrine\DBAL\DBALException: Unknown database type enum requested, Doctrine\DBAL\Platforms\MySqlPlatform may not support it
The Database already contains some tables with enum fields. But those should not be affected. They have no constraints to the tables managed by the EntityManager
Some debugging brought me to the point that Doctrine2 is trying to drop complete database, even metaclasses where given.
In Doctrine\ORM\Tools\SchemaTool $classes will not be used in any way
public function dropSchema(array $classes) { $dropSchemaSql = $this->getDropSchemaSql($classes); $conn = $this->_em->getConnection(); foreach ($dropSchemaSql as $sql) { $conn->executeQuery($sql); } } // Here $classes will not be used public function getDropSchemaSql(array $classes) { $sm = $this->_em->getConnection()->getSchemaManager(); $schema = $sm->createSchema(); $visitor = new \Doctrine\DBAL\Schema\Visitor\DropSchemaSqlCollector($this->_platform); /* @var $schema \Doctrine\DBAL\Schema\Schema */ $schema->visit($visitor); return $visitor->getQueries(); }
Also method SchemaTool::_getDropSchemaTablesDatabaseMode($classes) seems not to be used.
Fixed, duplicate of
DDC-629