Issue 487 db

This is ready for initial review. Thanks. 
So what's the resolution? Note that getting all the current paths is a simple sql command (where greatest ID)