Change tables to innodb, add foreign keys, and fix a few indexes