]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-4667, MDL-4112 switching order of columns in course-userid log table index in...
authorskodak <skodak>
Wed, 20 Feb 2008 09:33:18 +0000 (09:33 +0000)
committerskodak <skodak>
Wed, 20 Feb 2008 09:33:18 +0000 (09:33 +0000)
lib/db/upgrade.php
version.php

index efaa3526e3b7678917fa56c844daae1c58148989..556e64396ee2b812e6c83caf6eb3684f583b3ad5 100644 (file)
@@ -2826,6 +2826,33 @@ function xmldb_main_upgrade($oldversion=0) {
         upgrade_main_savepoint($result, 2007101508.02);
     }
 
+    if ($result && $oldversion < 2007101508.03) {
+
+    /// Define index course-userid (not unique) to be dropped form log
+        $table = new XMLDBTable('log');
+        $index = new XMLDBIndex('course-userid');
+        $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('course', 'userid'));
+
+    /// Launch drop index course-userid
+        if (index_exists($table, $index)) {
+            $result = $result && drop_index($table, $index);
+        }
+
+    /// Define index userid-course (not unique) to be added to log
+        $table = new XMLDBTable('log');
+        $index = new XMLDBIndex('userid-course');
+        $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('userid', 'course'));
+
+    /// Launch add index userid-course
+        if (!index_exists($table, $index)) {
+            $result = $result && add_index($table, $index);
+        }
+
+    /// Main savepoint reached
+        upgrade_main_savepoint($result, 2007101508.03);
+    }
+
+
     return $result;
 }
 
index aadf0de4823ecf04bee20317f4e1aa6a8f2ca458..dec4174b40abfe2a3464fcf85251a081a9886227 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 = 2007101508.02;  // YYYYMMDD = date
+    $version = 2007101508.03;  // YYYYMMDD = date
                             //       XY = increments within a single day
 
     $release = '2.0 dev';   // Human-friendly version name