DDC-46: Invalid MySQL column mappings #58

Closed
opened 2026-01-22 12:25:34 +01:00 by admin · 4 comments
Owner

Originally created by @doctrinebot on GitHub (Oct 14, 2009).

Jira issue originally created by user mcurcio:

I have a table for storing sessions in the database, schema is:

CREATE TABLE IF NOT EXISTS Session (
id varchar(255) NOT NULL,
data longtext NOT NULL,
created datetime NOT NULL,
accessed datetime NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

With the following code, I receive an error about an unknown 'clob' column. I believe the issue is related to the mappings in DBAL/Schema/MySQLSchemaManager::_getPortableTableColumnDefinition

Code:
$cmf = $em->getMetadataFactory();
$driver = $em->getConfiguration()->getMetadataDriverImpl();

    $driver->setClassDirectory(<model_path>);

    $classes = array();
    $preloadedClasses = $driver->preload();
    foreach ($preloadedClasses as $className) {
        $classes[] = $cmf->getMetadataFor($className);
    }

    $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($em);

foreach ($schemaTool->getUpdateSchemaSql($classes) as $sql) {
        echo $sql.'<br />';
    }

Error:
exception 'Doctrine\Common\DoctrineException' with message 'Unknown column type ('clob')' in /var/www/tec-expo.com/development/libraries/Doctrine/Common/DoctrineException.php:109
Stack trace:
#0 [internal function]: Doctrine\Common\DoctrineException::**callStatic('unknownColumnTy...', Array)
#1 libraries/Doctrine/DBAL/Types/Type.php(125): Doctrine\Common\DoctrineException::unknownColumnType('clob')
#2 libraries/Doctrine/DBAL/Schema/AbstractSchemaManager.php(871): Doctrine\DBAL\Types\Type::getType('clob')
#3 libraries/Doctrine/DBAL/Schema/AbstractSchemaManager.php(180): Doctrine\DBAL\Schema\AbstractSchemaManager->_getPortableTableColumnList(Array)
#4 libraries/Doctrine/ORM/Tools/SchemaTool.php(504): Doctrine\DBAL\Schema\AbstractSchemaManager->listTableColumns('Session')
#5 (MVC controller): Doctrine\ORM\Tools\SchemaTool->getUpdateSchemaSql(Array)

Originally created by @doctrinebot on GitHub (Oct 14, 2009). Jira issue originally created by user mcurcio: I have a table for storing sessions in the database, schema is: CREATE TABLE IF NOT EXISTS `Session` ( `id` varchar(255) NOT NULL, `data` longtext NOT NULL, `created` datetime NOT NULL, `accessed` datetime NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; With the following code, I receive an error about an unknown 'clob' column. I believe the issue is related to the mappings in DBAL/Schema/MySQLSchemaManager::_getPortableTableColumnDefinition Code: $cmf = $em->getMetadataFactory(); $driver = $em->getConfiguration()->getMetadataDriverImpl(); ``` $driver->setClassDirectory(<model_path>); $classes = array(); $preloadedClasses = $driver->preload(); foreach ($preloadedClasses as $className) { $classes[] = $cmf->getMetadataFor($className); } $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($em); foreach ($schemaTool->getUpdateSchemaSql($classes) as $sql) { echo $sql.'<br />'; } ``` Error: exception 'Doctrine\Common\DoctrineException' with message 'Unknown column type ('clob')' in /var/www/tec-expo.com/development/libraries/Doctrine/Common/DoctrineException.php:109 Stack trace: #0 [internal function]: Doctrine\Common\DoctrineException::**callStatic('unknownColumnTy...', Array) #1 libraries/Doctrine/DBAL/Types/Type.php(125): Doctrine\Common\DoctrineException::unknownColumnType('clob') #2 libraries/Doctrine/DBAL/Schema/AbstractSchemaManager.php(871): Doctrine\DBAL\Types\Type::getType('clob') #3 libraries/Doctrine/DBAL/Schema/AbstractSchemaManager.php(180): Doctrine\DBAL\Schema\AbstractSchemaManager->_getPortableTableColumnList(Array) #4 libraries/Doctrine/ORM/Tools/SchemaTool.php(504): Doctrine\DBAL\Schema\AbstractSchemaManager->listTableColumns('Session') #5 (MVC controller): Doctrine\ORM\Tools\SchemaTool->getUpdateSchemaSql(Array)
admin added the Bug label 2026-01-22 12:25:34 +01:00
admin closed this issue 2026-01-22 12:25:35 +01:00
Author
Owner

@doctrinebot commented on GitHub (Oct 14, 2009):

Comment created by romanb:

This should be fixed now in HEAD. Can you confirm that?

@doctrinebot commented on GitHub (Oct 14, 2009): Comment created by romanb: This should be fixed now in HEAD. Can you confirm that?
Author
Owner

@doctrinebot commented on GitHub (Oct 14, 2009):

Comment created by @jwage:

Which metadata driver are you using?

@doctrinebot commented on GitHub (Oct 14, 2009): Comment created by @jwage: Which metadata driver are you using?
Author
Owner

@doctrinebot commented on GitHub (Oct 14, 2009):

Comment created by mcurcio:

Yes, it appears to be fixed now.

@doctrinebot commented on GitHub (Oct 14, 2009): Comment created by mcurcio: Yes, it appears to be fixed now.
Author
Owner

@doctrinebot commented on GitHub (Oct 14, 2009):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Oct 14, 2009): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#58