Merge branch 'MDL-59084-master' of git://github.com/andrewnicols/moodle
authorDan Poltawski <dan@moodle.com>
Tue, 12 Sep 2017 14:28:26 +0000 (15:28 +0100)
committerDan Poltawski <dan@moodle.com>
Tue, 12 Sep 2017 14:28:26 +0000 (15:28 +0100)
1  2 
lib/db/install.xml
lib/db/upgrade.php
version.php

Simple merge
@@@ -2436,44 -2436,24 +2436,63 @@@ function xmldb_main_upgrade($oldversion
          upgrade_main_savepoint(true, 2017082800.00);
      }
  
 -    if ($oldversion < 2017090600.00) {
 +    if ($oldversion < 2017090700.01) {
 +
 +        // Define table analytics_prediction_actions to be created.
 +        $table = new xmldb_table('analytics_prediction_actions');
 +
 +        // Adding fields to table analytics_prediction_actions.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('predictionid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('actionname', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +
 +        // Adding keys to table analytics_prediction_actions.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +        $table->add_key('predictionid', XMLDB_KEY_FOREIGN, array('predictionid'), 'analytics_predictions', array('id'));
 +        $table->add_key('userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
 +
 +        // Adding indexes to table analytics_prediction_actions.
 +        $table->add_index('predictionidanduseridandactionname', XMLDB_INDEX_NOTUNIQUE,
 +            array('predictionid', 'userid', 'actionname'));
 +
 +        // Conditionally launch create table for analytics_prediction_actions.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2017090700.01);
 +    }
 +
 +    if ($oldversion < 2017091200.00) {
 +        // Force all messages to be reindexed.
 +        set_config('core_message_message_sent_lastindexrun', '0', 'core_search');
 +        set_config('core_message_message_received_lastindexrun', '0', 'core_search');
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2017091200.00);
 +    }
 +
++    if ($oldversion < 2017091201.00) {
+         // Define field userid to be added to task_adhoc.
+         $table = new xmldb_table('task_adhoc');
+         $field = new xmldb_field('userid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'customdata');
+         // Conditionally launch add field userid.
+         if (!$dbman->field_exists($table, $field)) {
+             $dbman->add_field($table, $field);
+         }
+         $key = new xmldb_key('useriduser', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
+         // Launch add key userid_user.
+         $dbman->add_key($table, $key);
+         // Main savepoint reached.
 -        upgrade_main_savepoint(true, 2017090600.00);
++        upgrade_main_savepoint(true, 2017091201.00);
+     }
      return true;
  }
diff --cc version.php
@@@ -29,7 -29,7 +29,7 @@@
  
  defined('MOODLE_INTERNAL') || die();
  
- $version  = 2017091200.00;              // YYYYMMDD      = weekly release date of this DEV branch.
 -$version  = 2017090700.00;              // YYYYMMDD      = weekly release date of this DEV branch.
++$version  = 2017091201.00;              // YYYYMMDD      = weekly release date of this DEV branch.
                                          //         RR    = release increments - 00 in DEV branches.
                                          //           .XX = incremental changes.