Reordered table creation so a rebuild will work

db wouldn't build, table creation order wasn't in dependency order