Clean up of the ORM

* remove unused methods in db.py
* increment method is moved from relation to table.