Commit 0b84fb7b authored by Nathan Nguyen's avatar Nathan Nguyen
Browse files

MDL-69572 mod_book : add bookid index to book_chapters

parent 5486b031
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/book/db" VERSION="20120515" COMMENT="XMLDB file for Moodle mod_book"
<XMLDB PATH="mod/book/db" VERSION="20200907" COMMENT="XMLDB file for Moodle mod_book"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
......@@ -39,6 +39,9 @@
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="bookid" UNIQUE="false" FIELDS="bookid"/>
</INDEXES>
</TABLE>
</TABLES>
</XMLDB>
......@@ -30,7 +30,9 @@ defined('MOODLE_INTERNAL') || die;
* @return bool always true
*/
function xmldb_book_upgrade($oldversion) {
global $CFG;
global $CFG, $DB;
$dbman = $DB->get_manager();
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
......@@ -47,5 +49,14 @@ function xmldb_book_upgrade($oldversion) {
// Automatically generated Moodle v3.9.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2021052501) {
$table = new xmldb_table('book_chapters');
$index = new xmldb_index('bookid', XMLDB_INDEX_NOTUNIQUE, ['bookid']);
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
upgrade_mod_savepoint(true, 2021052501, 'book');
}
return true;
}
......@@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die;
$plugin->component = 'mod_book'; // Full name of the plugin (used for diagnostics)
$plugin->version = 2021052500; // The current module version (Date: YYYYMMDDXX)
$plugin->version = 2021052501; // The current module version (Date: YYYYMMDDXX)
$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->cron = 0; // Period for cron to check this module (secs)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment