<?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20070804" COMMENT="XMLDB file for core Moodle tables"
+<XMLDB PATH="lib/db" VERSION="20070809" COMMENT="XMLDB file for core Moodle tables"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
<INDEX NAME="contextlevel-instanceid" UNIQUE="true" FIELDS="contextlevel, instanceid" NEXT="instanceid"/>
<INDEX NAME="instanceid" UNIQUE="false" FIELDS="instanceid" PREVIOUS="contextlevel-instanceid" NEXT="path"/>
<INDEX NAME="path" UNIQUE="false" FIELDS="path" PREVIOUS="instanceid"/>
-
</INDEXES>
</TABLE>
<TABLE NAME="context_rel" COMMENT="context relations, c2 is a parent (or higher) of c1" PREVIOUS="context" NEXT="capabilities">
<KEY NAME="scaleid" TYPE="foreign" FIELDS="scaleid" REFTABLE="scale" REFFIELDS="id" PREVIOUS="categoryid" NEXT="outcomeid"/>
<KEY NAME="outcomeid" TYPE="foreign" FIELDS="outcomeid" REFTABLE="grade_outcomes" REFFIELDS="id" PREVIOUS="scaleid"/>
</KEYS>
+ <INDEXES>
+ <INDEX NAME="locktime" UNIQUE="false" FIELDS="locktime" COMMENT="locktime index" NEXT="locked"/>
+ <INDEX NAME="locked" UNIQUE="false" FIELDS="locked" COMMENT="locked index" PREVIOUS="locktime" NEXT="itemtype"/>
+ <INDEX NAME="itemtype" UNIQUE="false" FIELDS="itemtype" COMMENT="itemtypeindex" PREVIOUS="locked" NEXT="needsupdate"/>
+ <INDEX NAME="needsupdate" UNIQUE="false" FIELDS="needsupdate" COMMENT="needsupdate index" PREVIOUS="itemtype"/>
+ </INDEXES>
</TABLE>
<TABLE NAME="grade_grades" COMMENT="grade_grades This table keeps individual grades for each user and each item, exactly as imported or submitted by modules. The rawgrademax/min and rawscaleid are stored here to record the values at the time the grade was stored, because teachers might change this for an activity! All the results are normalised/resampled for the final grade value." PREVIOUS="grade_items" NEXT="grade_grades_text">
<FIELDS>
<KEY NAME="rawscaleid" TYPE="foreign" FIELDS="rawscaleid" REFTABLE="scale" REFFIELDS="id" PREVIOUS="userid" NEXT="usermodified"/>
<KEY NAME="usermodified" TYPE="foreign" FIELDS="usermodified" REFTABLE="user" REFFIELDS="id" PREVIOUS="rawscaleid"/>
</KEYS>
+ <INDEXES>
+ <INDEX NAME="locktime" UNIQUE="false" FIELDS="locktime" COMMENT="locktiem index" NEXT="locked"/>
+ <INDEX NAME="locked" UNIQUE="false" FIELDS="locked" COMMENT="Locked index" PREVIOUS="locktime"/>
+ </INDEXES>
</TABLE>
<TABLE NAME="grade_grades_text" COMMENT="This table keeps additional textual information about each individual grade, whether it be automatically generated from the module or entered manually by the teacher. It's here separate from the all-numeric grade_grades for database efficiency reasons." PREVIOUS="grade_grades" NEXT="grade_outcomes_history">
<FIELDS>
</SENTENCES>
</STATEMENT>
</STATEMENTS>
-</XMLDB>
+</XMLDB>
\ No newline at end of file
$table->addKeyInfo('scaleid', XMLDB_KEY_FOREIGN, array('scaleid'), 'scale', array('id'));
$table->addKeyInfo('outcomeid', XMLDB_KEY_FOREIGN, array('outcomeid'), 'grade_outcomes', array('id'));
+ /// Adding indexes to table grade_grades
+ $table->addIndexInfo('locktime', XMLDB_INDEX_NOTUNIQUE, array('locktime'));
+ $table->addIndexInfo('locked', XMLDB_INDEX_NOTUNIQUE, array('locked'));
+ $table->addIndexInfo('itemtype', XMLDB_INDEX_NOTUNIQUE, array('itemtype'));
+ $table->addIndexInfo('needsupdate', XMLDB_INDEX_NOTUNIQUE, array('needsupdate'));
+
/// Launch create table for grade_items
$result = $result && create_table($table);
$table->addKeyInfo('rawscaleid', XMLDB_KEY_FOREIGN, array('rawscaleid'), 'scale', array('id'));
$table->addKeyInfo('usermodified', XMLDB_KEY_FOREIGN, array('usermodified'), 'user', array('id'));
+ /// Adding indexes to table grade_grades
+ $table->addIndexInfo('locktime', XMLDB_INDEX_NOTUNIQUE, array('locktime'));
+ $table->addIndexInfo('locked', XMLDB_INDEX_NOTUNIQUE, array('locked'));
+
/// Launch create table for grade_grades
$result = $result && create_table($table);
$result = $result && add_field($table, $field);
}
+ if ($result && $oldversion < 2007080901) {
+ /// Define index
+ $table = new XMLDBTable('grade_grades');
+ $index = new XMLDBIndex('locktime');
+ $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('locktime'));
+
+ if (!index_exists($table, $index)) {
+ /// Launch add index
+ $result = $result && add_index($table, $index);
+ }
+
+ /// Define index
+ $table = new XMLDBTable('grade_grades');
+ $index = new XMLDBIndex('locked');
+ $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('locked'));
+
+ if (!index_exists($table, $index)) {
+ /// Launch add index
+ $result = $result && add_index($table, $index);
+ }
+
+ /// Define index
+ $table = new XMLDBTable('grade_items');
+ $index = new XMLDBIndex('locktime');
+ $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('locktime'));
+
+ if (!index_exists($table, $index)) {
+ /// Launch add index
+ $result = $result && add_index($table, $index);
+ }
+
+ /// Define index
+ $table = new XMLDBTable('grade_items');
+ $index = new XMLDBIndex('locked');
+ $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('locked'));
+
+ if (!index_exists($table, $index)) {
+ /// Launch add index
+ $result = $result && add_index($table, $index);
+ }
+
+ /// Define index
+ $table = new XMLDBTable('grade_items');
+ $index = new XMLDBIndex('itemtype');
+ $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('itemtype'));
+
+ if (!index_exists($table, $index)) {
+ /// Launch add index
+ $result = $result && add_index($table, $index);
+ }
+
+ /// Define index
+ $table = new XMLDBTable('grade_items');
+ $index = new XMLDBIndex('needsupdate');
+ $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('needsupdate'));
+
+ if (!index_exists($table, $index)) {
+ /// Launch add index
+ $result = $result && add_index($table, $index);
+ }
+
+
+ }
+
/*
/// drop old gradebook tables
if ($result && $oldversion < 2007072209) {