Skip to content

Commit

Permalink
Merge branch 'MDL-62621-master-ixcomment' of git://github.com/mudrd8m…
Browse files Browse the repository at this point in the history
…z/moodle
  • Loading branch information
stronk7 committed Jul 2, 2018
2 parents 3f3d7fe + 82b7ad7 commit b197a1d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/db/install.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="lib/db" VERSION="20180403" COMMENT="XMLDB file for core Moodle tables"
<XMLDB PATH="lib/db" VERSION="20180618" COMMENT="XMLDB file for core Moodle tables"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
Expand Down Expand Up @@ -2638,7 +2638,11 @@
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="fk_user" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="ix_concomitem" UNIQUE="false" FIELDS="contextid, commentarea, itemid" COMMENT="Allows the comments API to load comments for a particular area effectively."/>
</INDEXES>
</TABLE>
<TABLE NAME="external_services" COMMENT="built in and custom external services">
<FIELDS>
Expand Down
21 changes: 21 additions & 0 deletions lib/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2233,5 +2233,26 @@ function xmldb_main_upgrade($oldversion) {
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.

if ($oldversion < 2018062800.01) {
// Add foreign key fk_user to the comments table.
$table = new xmldb_table('comments');
$key = new xmldb_key('fk_user', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
$dbman->add_key($table, $key);

upgrade_main_savepoint(true, 2018062800.01);
}

if ($oldversion < 2018062800.02) {
// Add composite index ix_concomitem to the table comments.
$table = new xmldb_table('comments');
$index = new xmldb_index('ix_concomitem', XMLDB_INDEX_NOTUNIQUE, array('contextid', 'commentarea', 'itemid'));

if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}

upgrade_main_savepoint(true, 2018062800.02);
}

return true;
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

defined('MOODLE_INTERNAL') || die();

$version = 2018062800.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2018062800.02; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.

Expand Down

0 comments on commit b197a1d

Please sign in to comment.