Also, improve comments.
<?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="mod/quiz/report/overview/db" VERSION="20080711" COMMENT="XMLDB file for Moodle mod/quiz/report/overview"
+<XMLDB PATH="mod/quiz/report/overview/db" VERSION="20090305" COMMENT="XMLDB file for Moodle mod/quiz/report/overview"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../lib/xmldb/xmldb.xsd"
>
<TABLES>
- <TABLE NAME="quiz_question_regrade" COMMENT="table to record which question attempts need regrading and the grade they will be regraded to.">
+ <TABLE NAME="quiz_question_regrade" COMMENT="This table records which question attempts need regrading and the grade they will be regraded to.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="questionid"/>
- <FIELD NAME="questionid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="attemptid"/>
- <FIELD NAME="attemptid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="questionid" NEXT="newgrade"/>
- <FIELD NAME="newgrade" TYPE="number" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" ENUM="false" DECIMALS="5" PREVIOUS="attemptid" NEXT="oldgrade"/>
- <FIELD NAME="oldgrade" TYPE="number" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" ENUM="false" DECIMALS="5" PREVIOUS="newgrade" NEXT="regraded"/>
+ <FIELD NAME="questionid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="Foreign key references question.id." PREVIOUS="id" NEXT="attemptid"/>
+ <FIELD NAME="attemptid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="Foreign key references question_attempt.id, or equivalently quiz_attempt.uniqueid." PREVIOUS="questionid" NEXT="newgrade"/>
+ <FIELD NAME="newgrade" TYPE="number" LENGTH="12" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" ENUM="false" DECIMALS="7" COMMENT="The new grade for this question after regrading." PREVIOUS="attemptid" NEXT="oldgrade"/>
+ <FIELD NAME="oldgrade" TYPE="number" LENGTH="12" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" ENUM="false" DECIMALS="7" COMMENT="The previous grade for this question in this attempt." PREVIOUS="newgrade" NEXT="regraded"/>
<FIELD NAME="regraded" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="set to 0 if element has just been regraded. Set to 1 if element has been marked as needing regrading." PREVIOUS="oldgrade" NEXT="timemodified"/>
- <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="regraded"/>
+ <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="Timestamp of when this row was last modified." PREVIOUS="regraded"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
$table->add_field('regraded', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
$table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
-
/// Adding keys to table quiz_question_regrade
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
}
}
+ if ($result && $oldversion < 2009030500) {
+ /// Changing precision of field newgrade on table quiz_question_regrade to (12, 7).
+ $table = new xmldb_table('quiz_question_regrade');
+ $field = new xmldb_field('newgrade', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, null, null, null, 'attemptid');
+
+ /// Launch change of precision for field newgrade
+ $dbman->change_field_precision($table, $field);
+ /// Changing precision of field oldgrade on table quiz_question_regrade to (12, 7).
+ $table = new xmldb_table('quiz_question_regrade');
+ $field = new xmldb_field('oldgrade', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, null, null, null, 'newgrade');
+
+ /// Launch change of precision for field newgrade
+ $dbman->change_field_precision($table, $field);
+ }
+
return $result;
}
// This fragment is called by moodle_needs_upgrading() and /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$plugin->version = 2008062700; // The (date) version of this module
+$plugin->version = 2009030500; // The (date) version of this module
?>