Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.0-BETA1
-
Fix Version/s: 2.0-BETA2
-
Component/s: Mapping Drivers
-
Security Level: All
-
Labels:None
-
Environment:PHP 5.3.1
PostgreSql 8.4
Description
I tried to import a schema from postgresql database, to a php file mapping.
I had created that database using doctrine schema tool with annotation mapping.
to import it, I used:
php doctrine orm:convert-mapping --from-database php ./php
and I got something like:
<?php use Doctrine\ORM\Mapping\ClassMetadataInfo; $metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_NONE); $metadata->setPrimaryTable(array( 'name' => 'mdp', )); $metadata->setChangeTrackingPolicy(ClassMetadataInfo::CHANGETRACKING_DEFERRED_IMPLICIT); $metadata->mapField(array( 'id' => true, 'fieldName' => 'id', 'columnName' => 'id', 'type' => 'integer', )); $metadata->mapField(array( 'fieldName' => 'rrn', 'columnName' => 'rrn', 'type' => 'string', 'length' => 50, 'fixed' => false, 'notnull' => false, )); $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE);
When I try to drop & create the database using this php mapping, the "notnull => false" doesn't work.
The column definition in the database is still NOT NULL. But when I add "nullable => true", it works like I expected (DEFAULT NULL::character varying)
Hi Andy,
do you think you could add such a .sql testfile for us? I will look into this shortly afterwards.
Thanks for helping!