On Tuesday, January 19, 2016 at 2:44:30 PM UTC-5, Niphlod wrote:
>
> uhm, it won't start at id = 1 though. at that point it's better to drop .
>

It's actually backend specific. For SQLite and MySQL, db.mytable.truncate() 
will reset the ID to 1 (this works for SQLite because the DAL explicitly 
deletes the sequence, as SQLite does not have a truncate command). By 
default, PostgreSQL will *not *reset the ID, but you can force it via:

db.mytable.truncate('RESET IDENTITY')

But yes, simply dropping the table (and allowing it to then be re-created 
via migrations) would guarantee a reset of the ID on all backends.

Anthony

-- 
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.

Reply via email to