diff --git a/lib/db/install.xml b/lib/db/install.xml
index 2e52477544f..2915e60896c 100644
--- a/lib/db/install.xml
+++ b/lib/db/install.xml
@@ -431,9 +431,11 @@
+
+
@@ -449,6 +451,7 @@
+
diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php
index 678b86b9693..5f50fa4375a 100644
--- a/lib/db/upgrade.php
+++ b/lib/db/upgrade.php
@@ -2639,5 +2639,33 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2017040300.05);
}
+ if ($oldversion < 2017040300.06) {
+
+ // Define fields to be added to the 'event' table.
+ $table = new xmldb_table('event');
+ $fieldtype = new xmldb_field('type', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, 0, 'instance');
+ $fieldtimesort = new xmldb_field('timesort', XMLDB_TYPE_INTEGER, '10', null, false, null, null, 'timeduration');
+
+ // Conditionally launch add field.
+ if (!$dbman->field_exists($table, $fieldtype)) {
+ $dbman->add_field($table, $fieldtype);
+ }
+
+ // Conditionally launch add field.
+ if (!$dbman->field_exists($table, $fieldtimesort)) {
+ $dbman->add_field($table, $fieldtimesort);
+ }
+
+ // Now, define the index we will be adding.
+ $index = new xmldb_index('type-timesort', XMLDB_INDEX_NOTUNIQUE, array('type', 'timesort'));
+
+ // Conditionally launch add index.
+ if (!$dbman->index_exists($table, $index)) {
+ $dbman->add_index($table, $index);
+ }
+
+ upgrade_main_savepoint(true, 2017040300.06);
+ }
+
return true;
}
diff --git a/version.php b/version.php
index 75869935df8..1d6c5a942db 100644
--- a/version.php
+++ b/version.php
@@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
-$version = 2017040300.05; // YYYYMMDD = weekly release date of this DEV branch.
+$version = 2017040300.06; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.