Fix crazy-annoying bug in creating the four many-to-many database tables.