Thanks for looking it over.
Given what you've told me I've made two more commits, the first is to remove the default values from the grade fields, I did this with XMLDB editor, it didn't seem to have any problem with it, perhaps a recent fix?
The second commit was to remove the @global moodle_database $DB as requested.
In regards to the @globals I am personally a fan of those, it allows Netbeans to auto-complete for me, without it sometimes it will sometimes it won't. As it is part of the PHPdocs I didn't think it would hurt to add it, although I completely understand that anyone who is familiar with Moodle will instantly skip over it as useless information.
There is a small story in regards to the changes made in the commit you asked about, bc90ac.
When I first started work on fixing the discrepancies within the core tables I chatted to Eloy about whether or not we should change old upgrade code, after a bit of discussion we decided that it would be best to both change upgrade code so that new sites or sites that have not upgraded yet are fixed as early on as possible, and at the same time add conditions around the new upgrade code so that those who's database is correct don't have the burden of running the unnecessary upgrade code.
In the case of core tables this saves us having to drop+recreate indexes, and avoid other timetaking tasks. For the quiz it didn't look like there was any changes that would significantly hurt performance however I added the conditions anyway.
If you prefer they can be removed, given you know that story behind it now I am quite happy to go with what ever you recommend.
Let me know your thoughts on the above and whether you are happy with the further changes.