Hi,
I have been using Web2py for couple years now, but have not been able to
find a decent solution to this issue.
When creating a new web app I am constantly updating new fields to a
database table after I already have data there. When I add a new field, I
want it to have a default value for it, but for some reason web2py always
has the value at None for the new field even though I have defined it to be
0.
For example:
db.define_table(
'persons',
Field('old_field','integer',default=0),
Field('new_field','integer',default=0)
)
The new_field is now updated to the table correctly, but instead of 0 it is
None for the old records.
This is annoying as I am assuming old tables to have the new_field also set
as 0 and now I must write code to assume None and change it manually to 0.
Am I missing something?
Ykä
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.