MDL-10757 adding some more table indexes for grades code

This commit is contained in:
skodak 2007-08-09 12:29:05 +00:00
parent 4f6bd3b9c1
commit 6c9f672529
3 changed files with 11 additions and 47 deletions

View File

@ -1369,10 +1369,8 @@
<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="itemtype-needsupdate"/>
<INDEX NAME="itemtype-needsupdate" UNIQUE="false" FIELDS="itemtype, needsupdate" COMMENT="used in grading cron" PREVIOUS="itemtype" NEXT="gradetype"/>
<INDEX NAME="locked-locktime" UNIQUE="false" FIELDS="locked, locktime" COMMENT="used in grading cron" NEXT="itemtype-needsupdate"/>
<INDEX NAME="itemtype-needsupdate" UNIQUE="false" FIELDS="itemtype, needsupdate" COMMENT="used in grading cron" PREVIOUS="locked-locktime" NEXT="gradetype"/>
<INDEX NAME="gradetype" UNIQUE="false" FIELDS="gradetype" COMMENT="index for gradetype" PREVIOUS="itemtype-needsupdate"/>
</INDEXES>
</TABLE>
@ -1404,8 +1402,7 @@
<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"/>
<INDEX NAME="locked-locktime" UNIQUE="false" FIELDS="locked, locktime" COMMENT="used in grading cron"/>
</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">

View File

@ -1126,9 +1126,7 @@ function xmldb_main_upgrade($oldversion=0) {
$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('locked-locktime', XMLDB_INDEX_NOTUNIQUE, array('locked', 'locktime'));
$table->addIndexInfo('itemtype-needsupdate', XMLDB_INDEX_NOTUNIQUE, array('itemtype', 'needsupdate'));
$table->addIndexInfo('gradetype', XMLDB_INDEX_NOTUNIQUE, array('gradetype'));
@ -1166,8 +1164,7 @@ function xmldb_main_upgrade($oldversion=0) {
$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'));
$table->addIndexInfo('locked-locktime', XMLDB_INDEX_NOTUNIQUE, array('locked', 'locktime'));
/// Launch create table for grade_grades
$result = $result && create_table($table);
@ -1663,21 +1660,11 @@ function xmldb_main_upgrade($oldversion=0) {
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2007080902) {
if ($result && $oldversion < 2007080903) {
/// 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'));
$index = new XMLDBIndex('locked-locktime');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('locked', 'locktime'));
if (!index_exists($table, $index)) {
/// Launch add index
@ -1686,28 +1673,8 @@ function xmldb_main_upgrade($oldversion=0) {
/// 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'));
$index = new XMLDBIndex('locked-locktime');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('locked', 'locktime'));
if (!index_exists($table, $index)) {
/// Launch add index

View File

@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
$version = 2007080902; // YYYYMMDD = date
$version = 2007080903; // YYYYMMDD = date
// XY = increments within a single day
$release = '1.9 dev'; // Human-friendly version name