[web2py] Re: migration fails when modifying field with notnull=True

2011-10-11 Thread Alex
I think this has to do with the web2py migration code. Maybe it only
happens if the db is PostgreSQL. Now that I know that a default value
should hopefully solve this its not an issue for me anymore. But I
think it should not be necessary in first place, or if it is, it would
be good if it would be mentioned in the documentation.

Alex


[web2py] Re: migration fails when modifying field with notnull=True

2011-10-10 Thread Mathew Grabau
Specify a default value for the field, there may be NULLs in that column 
right now, which violates the NULL contraint you are adding to the table.

Perhaps 0 would make a good default for your field.


[web2py] Re: migration fails when modifying field with notnull=True

2011-10-10 Thread Alex
As shown in the example above the field already had a notnull=True
constraint so there were no NULLs in the existing rows. But
nevertheless it works with a default value, thanks!

It seems that a default value is needed for the migration process by
web2py. Is this true?


[web2py] Re: migration fails when modifying field with notnull=True

2011-10-10 Thread Mathew Grabau
I can't say for sure, sorry. Given the error comes from PostgreSQL 
(IntegrityError), I'd wager it's probably a PostgreSQL thing.