Permalink
Browse files

lib-db MDL-25790 Added missing rating indexs on existing 2.0 sites

  • Loading branch information...
1 parent 15257dd commit 6d02316093911a0d5d42e3f2a49371b621220df4 Sam Hemelryk committed Jan 14, 2011
Showing with 19 additions and 1 deletion.
  1. +18 −0 lib/db/upgrade.php
  2. +1 −1 version.php
View
@@ -5936,6 +5936,24 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2011011414);
}
+
+ if ($oldversion < 2011011415) {
+ //create the rating table indexes if required
+ $table = new xmldb_table('rating');
+
+ $index = new xmldb_index('itemid', XMLDB_INDEX_NOTUNIQUE, array('itemid'));
+ if (!$dbman->index_exists($table, $index)) {
+ $dbman->add_index($table, $index);
+
+ $key = new xmldb_key('contextid', XMLDB_KEY_FOREIGN, array('contextid'), 'context', array('id'));
+ $dbman->add_key($table, $key);
+
+ $key = new xmldb_key('userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
+ $dbman->add_key($table, $key);
+ }
+
+ upgrade_main_savepoint(true, 2011011415);
+ }
return true;
}
View
@@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
-$version = 2011011414; // YYYYMMDD = date of the last version bump
+$version = 2011011415; // YYYYMMDD = date of the last version bump
// XX = daily increments
$release = '2.0.1+ (Build: 20110112)'; // Human-friendly version name

0 comments on commit 6d02316

Please sign in to comment.