upgrade_main_savepoint(true, 2018101800.00);
}
- if ($oldversion < 2018101900.01) {
+ if ($oldversion < 2018102200.00) {
+ // Add field 'type' to 'message_conversations'.
+ $table = new xmldb_table('message_conversations');
+ $field = new xmldb_field('type', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, 1, 'id');
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+
+ // Add field 'name' to 'message_conversations'.
+ $field = new xmldb_field('name', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'type');
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+
+ // Conditionally launch add index 'type'.
+ $index = new xmldb_index('type', XMLDB_INDEX_NOTUNIQUE, ['type']);
+ if (!$dbman->index_exists($table, $index)) {
+ $dbman->add_index($table, $index);
+ }
+
+ // Define table 'message_conversations' to be updated.
+ $table = new xmldb_table('message_conversations');
+
+ // Remove the unique 'convhash' index, change to null and add a new non unique index.
+ $index = new xmldb_index('convhash', XMLDB_INDEX_UNIQUE, ['convhash']);
+ if ($dbman->index_exists($table, $index)) {
+ $dbman->drop_index($table, $index);
+ }
+
+ $field = new xmldb_field('convhash', XMLDB_TYPE_CHAR, '40', null, null, null, null, 'name');
+ $dbman->change_field_notnull($table, $field);
+
+ $index = new xmldb_index('convhash', XMLDB_INDEX_NOTUNIQUE, ['convhash']);
+ if (!$dbman->index_exists($table, $index)) {
+ $dbman->add_index($table, $index);
+ }
+
+ upgrade_main_savepoint(true, 2018102200.00);
+ }
+
+ if ($oldversion < 2018102300.02) {
+ // Alter 'message_conversations' table to support groups.
+ $table = new xmldb_table('message_conversations');
+ $field = new xmldb_field('component', XMLDB_TYPE_CHAR, '100', null, null, null, null, 'convhash');
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+
+ $field = new xmldb_field('itemtype', XMLDB_TYPE_CHAR, '100', null, null, null, null, 'component');
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+
+ $field = new xmldb_field('itemid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'itemtype');
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+
+ $field = new xmldb_field('contextid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'itemid');
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+
+ $field = new xmldb_field('enabled', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, 0, 'contextid');
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+
+ $field = new xmldb_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'enabled');
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+
+ // Add key.
+ $key = new xmldb_key('contextid', XMLDB_KEY_FOREIGN, ['contextid'], 'context', ['id']);
+ $dbman->add_key($table, $key);
+
+ // Add index.
+ $index = new xmldb_index('component-itemtype-itemid-contextid', XMLDB_INDEX_NOTUNIQUE, ['component', 'itemtype',
+ 'itemid', 'contextid']);
+ if (!$dbman->index_exists($table, $index)) {
+ $dbman->add_index($table, $index);
+ }
+
+ upgrade_main_savepoint(true, 2018102300.02);
+ }
+
+ if ($oldversion < 2018102900.00) {
+ // Define field predictionsprocessor to be added to analytics_models.
+ $table = new xmldb_table('analytics_models');
+ $field = new xmldb_field('predictionsprocessor', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'timesplitting');
+
+ // Conditionally launch add field predictionsprocessor.
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2018102900.00);
+ }
+
++ if ($oldversion < 2018102900.01) {
+ // Show course images by default.
+ set_config('showcourseimages', 1, 'moodlecourse');
- upgrade_main_savepoint(true, 2018101900.01);
++ upgrade_main_savepoint(true, 2018102900.01);
+ }
+
return true;
}