[DC-928] [Migrations] Drop not null is not working in Postgres Created: 16/Nov/10  Updated: 16/Nov/10

Status: Open
Project: Doctrine 1
Component/s: Migrations
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Lea Haensenberger Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 1
Labels: None
Environment:

Postgresql 8.4, Symfony 1.4, Doctrine 1.2


Attachments: Text File dropNotNullPatch.patch    

 Description   

When removing the not null from a column the migration does not change anything in the database. This is due to the following check on line 162 of lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Export/Pgsql.php
if ( ! empty($field['definition']['notnull']))

So if notnull is not there or set to false or '0' or 0 the code does not enter into that if statement and therefore no changes are done to the not null value of the column.



 Comments   
Comment by Lukas Kahwe [ 16/Nov/10 ]

@Lea: can you write up a patch for this? would also be nice if you could check if the same issue affects other drivers.

Comment by Lea Haensenberger [ 16/Nov/10 ]

Here is a patch (attachment). The generate-migrations-diff Task in Symfony sets 'notnull' to an empty string if it's false in the schema.yml, therefore the check for empty string.

I had a quick look at the classes for other DBs, but that seems to be a postgres only issue.

Generated at Wed Nov 26 21:45:37 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.