Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:Latest doctrine git commit: bfa24eb68640c412ff6115103ba044bbe1b4333b
Ubuntu 10.4 x64
MySQL server 5.1.41-3ubuntu12.6
PHP 5.3.2
Description
Doctrine says : "Primary columns are implied to be notnull in Doctrine" (line 563 in lib/Doctrine/Import/Builder.php)
But when generating (My)SQL statements, primary fields are not set to "NOT NULL" even if it is specified in the YAML and/or Model file.
If doctrine unsets the 'notnull' option on line 565 in lib/Doctrine/Import/Builder.php (as it does), it should make sure to add the "NOT NULL" to the SQL when appropriate :
- in getNotNullFieldDeclaration() method (line 798) in lib/Doctrine/Export.php
AND - in getDeclaration() method (line 272) in lib/Doctrine/Export/Mysql.php
Solution #1: In both places, check if field is primary, and if so, add "NOT NULL" to SQL, since "Primary columns are implied to be notnull in Doctrine".
Solution #2: Change Doctrine as to not enforce this behaviour (eg. remove the check in lib/Doctrine/Import/Builder.php on line 565)
Thx for this great ORM.
~ Jonathan