No. This would go after the table definitions (the old table
definition).

db(db.address.number==None).update(number=0)

On Oct 30, 2:40 am, annet <annet.verm...@gmail.com> wrote:
> Massimo,
>
> > 1) you inserted records that had Null values for number
>
> As far as I can tell I didn't, because the number field's notnull was
> set to True.
>
> > 2) you added the attribute notnull=True but those records are still
> > there
>
> The notnull=True has been in the table definition, from the moment I
> defined it.
>
> > before you do the migration run
>
> > db(db.address.number==None).update(number=0)
>
> I tried:
>
> db.define_table('address',
>     db.Field(..),
>     db.Field('number',length=9,default='',notnull=True),
>     db.Field(),
>     db(db.address.number==None).update(number=0),
>     migrate='address.table')
>
> ... but that results in the following error:
>
> Traceback (most recent call last):
>   File "/Library/Python/2.5/site-packages/web2py/gluon/restricted.py",
> line 184, in restricted
>     exec ccode in environment
>   File "/Library/Python/2.5/site-packages/web2py/applications/base/
> models/db.py", line 155, in <module>
>     db(db.address.number==None).update(number=0),
>   File "/Library/Python/2.5/site-packages/web2py/gluon/sql.py", line
> 605, in __getattr__
>     return dict.__getitem__(self,key)
> KeyError: 'address'
>
> Kind regards,
>
> Annet.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to