MDL-46826 forum: add index on field forum_discussion.course

This commit is contained in:
Marina Glancy
2014-08-15 13:06:23 +08:00
parent e1eb180806
commit 73de21ffda
3 changed files with 19 additions and 3 deletions
+3 -2
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/forum/db" VERSION="20140605" COMMENT="XMLDB file for Moodle mod/forum"
<XMLDB PATH="mod/forum/db" VERSION="20140815" COMMENT="XMLDB file for Moodle mod/forum"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
@@ -59,6 +59,7 @@
</KEYS>
<INDEXES>
<INDEX NAME="userid" UNIQUE="false" FIELDS="userid"/>
<INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
</INDEXES>
</TABLE>
<TABLE NAME="forum_posts" COMMENT="All posts are stored in this table">
@@ -183,4 +184,4 @@
</KEYS>
</TABLE>
</TABLES>
</XMLDB>
</XMLDB>
+15
View File
@@ -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;
}
+1 -1
View File
@@ -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;