I think this is because the foreign key constraint has a different name to what's expected, perhaps due to some manual database changes that were performed. You'd need to examine your qa_posts table to see what name is used for the constraint that refers to the qa_categories table, and then modify the line after case 30: in qa-db-install.php accordingly.