#1690: MSSQL driver incorrectly sets Primary key field to allow NULL
---------------------------+------------------------------------------------
Reporter: denpet | Owner: jwage
Type: defect | Status: reopened
Priority: minor | Milestone:
Component: Schema Files | Version: 1.1-DEV
Resolution: | Keywords: mssql primary key null
Has_test: 0 | Mystatus: Pending Core Response
Has_patch: 0 |
---------------------------+------------------------------------------------
Changes (by denpet):
* status: closed => reopened
* resolution: fixed =>
Comment:
That is in relation to importing from the database.
The problem I explained is when you export DDL to the database.
Try this;
Change in Doctrine/Export/Mssql.php
{{{
public function getNotNullFieldDeclaration(array $definition)
{
return ((isset($definition['notnull']) && $definition['notnull'])
|| (isset($definition['primary']) && $definition['primary']))
? ' NOT NULL' : ' NULL';
}
}}}
The problem arise from Doctrin/Export.php defining the function as
{{{
public function getNotNullFieldDeclaration(array $definition)
{
return (isset($definition['notnull']) && $definition['notnull']) ?
' NOT NULL' : '';
}
}}}
which would be ok for a PK. Mssql will default an omitted NULL specifier
as NOT NULL for PK fields.
--
Ticket URL: <http://trac.doctrine-project.org/ticket/1690#comment:3>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"doctrine-svn" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---