remove use of history.dateFormat.  It's unneed as peewee does this automatically.

Change peewee improt to use the version in lib/

Change peewee to log before trying to execute a query so you can actually see the query if it explodes.

Strip out the remaining old db code