diff --git a/mod/forum/db/install.xml b/mod/forum/db/install.xml index 3f6b111012f..10867e81c8a 100644 --- a/mod/forum/db/install.xml +++ b/mod/forum/db/install.xml @@ -1,5 +1,5 @@ - @@ -59,6 +59,7 @@ + @@ -183,4 +184,4 @@
-
+ \ No newline at end of file diff --git a/mod/forum/db/upgrade.php b/mod/forum/db/upgrade.php index aaa335371cc..0aeee7f6fc2 100644 --- a/mod/forum/db/upgrade.php +++ b/mod/forum/db/upgrade.php @@ -185,5 +185,20 @@ function xmldb_forum_upgrade($oldversion) { upgrade_mod_savepoint(true, 2014051202, 'forum'); } + if ($oldversion < 2014081500) { + + // Define index course (not unique) to be added to forum_discussions. + $table = new xmldb_table('forum_discussions'); + $index = new xmldb_index('course', XMLDB_INDEX_NOTUNIQUE, array('course')); + + // Conditionally launch add index course. + if (!$dbman->index_exists($table, $index)) { + $dbman->add_index($table, $index); + } + + // Forum savepoint reached. + upgrade_mod_savepoint(true, 2014081500, 'forum'); + } + return true; } diff --git a/mod/forum/version.php b/mod/forum/version.php index 0c36a5a527e..f6d07e00003 100644 --- a/mod/forum/version.php +++ b/mod/forum/version.php @@ -24,7 +24,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2014051202; // The current module version (Date: YYYYMMDDXX) +$plugin->version = 2014081500; // The current module version (Date: YYYYMMDDXX) $plugin->requires = 2014050800; // Requires this Moodle version $plugin->component = 'mod_forum'; // Full name of the plugin (used for diagnostics) $plugin->cron = 60;