There’s the enable_forum field on the bp_groups table. All of my groups have this set to 1. But changing this doesn’t actually create a forum for the groups that don’t have one. It just enables the “Forum” tab for that group, and I get the error message if I try to post.
Disabling and enabling the forums from the front end not only changes the enable_forum field, but it also creates a bbPress forum and sets the corresponding forum_id.