MDL-29089 gradebook: added missing columns to the history tables

This commit is contained in:
Andrew Davis (andyjdavis)
2011-09-29 09:53:18 +08:00
parent e63ae067f4
commit 70e61f7071
3 changed files with 60 additions and 6 deletions
Regular → Executable
+9 -5
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="lib/db" VERSION="20110915" COMMENT="XMLDB file for core Moodle tables"
<XMLDB PATH="lib/db" VERSION="20110926" COMMENT="XMLDB file for core Moodle tables"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
@@ -1820,7 +1820,8 @@
<FIELD NAME="shortname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="The short name or code for this outcome statement" PREVIOUS="courseid" NEXT="fullname"/>
<FIELD NAME="fullname" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" COMMENT="The full description of the outcome (usually 1 sentence)" PREVIOUS="shortname" NEXT="scaleid"/>
<FIELD NAME="scaleid" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" COMMENT="The recommended scale for this outcome." PREVIOUS="fullname" NEXT="description"/>
<FIELD NAME="description" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" COMMENT="Outcome description" PREVIOUS="scaleid"/>
<FIELD NAME="description" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" COMMENT="Outcome description" PREVIOUS="scaleid" NEXT="descriptionformat"/>
<FIELD NAME="descriptionformat" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="description"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="oldid"/>
@@ -1851,7 +1852,8 @@
<FIELD NAME="droplow" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" COMMENT="Drop the X lowest items" PREVIOUS="keephigh" NEXT="aggregateonlygraded"/>
<FIELD NAME="aggregateonlygraded" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="aggregate only graded items" PREVIOUS="droplow" NEXT="aggregateoutcomes"/>
<FIELD NAME="aggregateoutcomes" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Aggregate outcomes" PREVIOUS="aggregateonlygraded" NEXT="aggregatesubcats"/>
<FIELD NAME="aggregatesubcats" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="ignore subcategories in aggregation" PREVIOUS="aggregateoutcomes"/>
<FIELD NAME="aggregatesubcats" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="ignore subcategories in aggregation" PREVIOUS="aggregateoutcomes" NEXT="hidden"/>
<FIELD NAME="hidden" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="aggregatesubcats"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="oldid"/>
@@ -1895,7 +1897,9 @@
<FIELD NAME="hidden" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" COMMENT="1 is hidden, &amp;gt; 1 is a date to hide until (prevents viewing)" PREVIOUS="sortorder" NEXT="locked"/>
<FIELD NAME="locked" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" COMMENT="1 is locked, &amp;gt; 1 is a date to lock until (prevents update)" PREVIOUS="hidden" NEXT="locktime"/>
<FIELD NAME="locktime" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="lock all final grades after this date" PREVIOUS="locked" NEXT="needsupdate"/>
<FIELD NAME="needsupdate" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" COMMENT="If this flag is set, then the whole column will be recalculated" PREVIOUS="locktime"/>
<FIELD NAME="needsupdate" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" COMMENT="If this flag is set, then the whole column will be recalculated" PREVIOUS="locktime" NEXT="display"/>
<FIELD NAME="display" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" PREVIOUS="needsupdate" NEXT="decimals"/>
<FIELD NAME="decimals" TYPE="int" LENGTH="1" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="display"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="oldid"/>
@@ -2782,4 +2786,4 @@
</KEYS>
</TABLE>
</TABLES>
</XMLDB>
</XMLDB>
Regular → Executable
+50
View File
@@ -6728,6 +6728,56 @@ FROM
upgrade_main_savepoint(true, 2011091600.01);
}
if ($oldversion < 2011092800.00) {
// Check for potential missing columns in the grade_items_history
$table = new xmldb_table('grade_items_history');
$field = new xmldb_field('display', XMLDB_TYPE_INTEGER, '10', XMLDB_TYPE_INTEGER, XMLDB_NOTNULL, null, 0, 'sortorder');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
$field = new xmldb_field('decimals', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, null, 'display');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
} else {
//check that the grade_items_history.decimals allows nulls
//Somehow some Moodle databases have this column marked as "not null"
$columns = $DB->get_columns('grade_items_history');
if (array_key_exists('display', $columns) && !empty($columns['display']->not_null)) {
$dbman->change_field_notnull($table, $field);
}
}
// Main savepoint reached
upgrade_main_savepoint(true, 2011092800.00);
}
if ($oldversion < 2011092800.01) {
// Check for potential missing columns in the grade_categories_history
$table = new xmldb_table('grade_categories_history');
$field = new xmldb_field('hidden', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'timemodified');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Main savepoint reached
upgrade_main_savepoint(true, 2011092800.01);
}
if ($oldversion < 2011092800.02) {
// Check for potential missing columns in the grade_outcomes_history
$table = new xmldb_table('grade_outcomes_history');
$field = new xmldb_field('descriptionformat', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'description');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Main savepoint reached
upgrade_main_savepoint(true, 2011092800.02);
}
return true;
}
+1 -1
View File
@@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die();
$version = 2011092100.00; // YYYYMMDD = weekly release date of this DEV branch
$version = 2011092800.02; // YYYYMMDD = weekly release date of this DEV branch
// RR = release increments - 00 in DEV branches
// .XX = incremental changes