#291 Fix a bunch of db schema issues