Convert the db sanity checks to Peewee.