Merge branch 'MDL-60520_master' of git://github.com/dmonllao/moodle
authorAndrew Nicols <andrew@nicols.co.uk>
Sun, 28 Oct 2018 23:39:58 +0000 (07:39 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Sun, 28 Oct 2018 23:39:58 +0000 (07:39 +0800)
1  2 
lib/db/install.xml
lib/db/upgrade.php
version.php

Simple merge
@@@ -2566,91 -2566,18 +2566,105 @@@ function xmldb_main_upgrade($oldversion
      }
  
      if ($oldversion < 2018102200.00) {
 -        upgrade_main_savepoint(true, 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);
+     }
      return true;
  }
diff --cc version.php
@@@ -29,7 -29,7 +29,7 @@@
  
  defined('MOODLE_INTERNAL') || die();
  
- $version  = 2018102700.00;              // YYYYMMDD      = weekly release date of this DEV branch.
 -$version  = 2018102200.00;              // YYYYMMDD      = weekly release date of this DEV branch.
++$version  = 2018102900.00;              // YYYYMMDD      = weekly release date of this DEV branch.
                                          //         RR    = release increments - 00 in DEV branches.
                                          //           .XX = incremental changes.