More database fixes, all the _id columns are now integers so they can be used as primary keys