]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-10757 adding some more table indexes for grades code
authorskodak <skodak>
Thu, 9 Aug 2007 12:29:05 +0000 (12:29 +0000)
committerskodak <skodak>
Thu, 9 Aug 2007 12:29:05 +0000 (12:29 +0000)
lib/db/install.xml
lib/db/upgrade.php
version.php

index e4386e6ff2bfba0d4160bc6e801886329cc109a9..64d0e38ff81039f642b76d49bf6dce2d62862ab1 100644 (file)
         <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>
         <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">
index cb3aefb409702f39a560a11a331ee2a8160c3424..26d392c43da0902569baeed5d886b9abeb019eb0 100644 (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,41 +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'));
-
-        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'));
+        $index = new XMLDBIndex('locked-locktime');
+        $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('locked', 'locktime'));
 
         if (!index_exists($table, $index)) {
         /// Launch add index
@@ -1706,8 +1673,8 @@ function xmldb_main_upgrade($oldversion=0) {
 
     /// 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
index deba7a5c38d65b70891c2e33690ac6aa74ce59bb..2a0609028fe41f9ae641b7889ec46782defc6ff4 100644 (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