Merge branch 'MDL-59106_master' of git://github.com/markn86/moodle
authorJake Dallimore <jake@moodle.com>
Thu, 12 Oct 2017 02:53:20 +0000 (10:53 +0800)
committerJake Dallimore <jake@moodle.com>
Thu, 12 Oct 2017 02:53:20 +0000 (10:53 +0800)
1  2 
analytics/classes/model.php
lib/db/install.xml
lib/db/upgrade.php
version.php

Simple merge
Simple merge
@@@ -2601,81 -2601,26 +2601,103 @@@ function xmldb_main_upgrade($oldversion
          upgrade_main_savepoint(true, 2017092900.00);
      }
  
 -    if ($oldversion < 2017100601.00) {
 +    if ($oldversion < 2017100900.00) {
 +        // Add index on time modified to grade_outcomes_history, grade_categories_history,
 +        // grade_items_history, and scale_history.
 +        $table = new xmldb_table('grade_outcomes_history');
 +        $index = new xmldb_index('timemodified', XMLDB_INDEX_NOTUNIQUE, array('timemodified'));
 +
 +        if (!$dbman->index_exists($table, $index)) {
 +            $dbman->add_index($table, $index);
 +        }
 +
 +        $table = new xmldb_table('grade_items_history');
 +        $index = new xmldb_index('timemodified', XMLDB_INDEX_NOTUNIQUE, array('timemodified'));
 +
 +        if (!$dbman->index_exists($table, $index)) {
 +            $dbman->add_index($table, $index);
 +        }
 +
 +        $table = new xmldb_table('grade_categories_history');
 +        $index = new xmldb_index('timemodified', XMLDB_INDEX_NOTUNIQUE, array('timemodified'));
 +
 +        if (!$dbman->index_exists($table, $index)) {
 +            $dbman->add_index($table, $index);
 +        }
 +
 +        $table = new xmldb_table('scale_history');
 +        $index = new xmldb_index('timemodified', XMLDB_INDEX_NOTUNIQUE, array('timemodified'));
 +
 +        if (!$dbman->index_exists($table, $index)) {
 +            $dbman->add_index($table, $index);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2017100900.00);
 +    }
 +
 +    if ($oldversion < 2017101000.00) {
 +
 +        // Define table analytics_used_analysables to be created.
 +        $table = new xmldb_table('analytics_used_analysables');
 +
 +        // Adding fields to table analytics_used_analysables.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('modelid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('action', XMLDB_TYPE_CHAR, '50', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('analysableid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timeanalysed', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +
 +        // Adding keys to table analytics_used_analysables.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +        $table->add_key('modelid', XMLDB_KEY_FOREIGN, array('modelid'), 'analytics_models', array('id'));
 +
 +        // Adding indexes to table analytics_used_analysables.
 +        $table->add_index('modelid-action', XMLDB_INDEX_NOTUNIQUE, array('modelid', 'action'));
 +
 +        // Conditionally launch create table for analytics_used_analysables.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2017101000.00);
 +    }
 +
 +    if ($oldversion < 2017101000.01) {
 +        // Define field override to be added to course_modules_completion.
 +        $table = new xmldb_table('course_modules_completion');
 +        $field = new xmldb_field('overrideby', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'viewed');
 +
 +        // Conditionally launch add field override.
 +        if (!$dbman->field_exists($table, $field)) {
 +            $dbman->add_field($table, $field);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2017101000.01);
++      }
++
++      if ($oldversion < 2017101000.02) {
+         // Define field 'timestart' to be added to 'analytics_predictions'.
+         $table = new xmldb_table('analytics_predictions');
+         $field = new xmldb_field('timestart', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'timecreated');
+         // Conditionally launch add field 'timestart'.
+         if (!$dbman->field_exists($table, $field)) {
+             $dbman->add_field($table, $field);
+         }
+         // Define field 'timeend' to be added to 'analytics_predictions'.
+         $field = new xmldb_field('timeend', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'timestart');
+         // Conditionally launch add field 'timeend'.
+         if (!$dbman->field_exists($table, $field)) {
+             $dbman->add_field($table, $field);
+         }
+         // Main savepoint reached.
 -        upgrade_main_savepoint(true, 2017100601.00);
++        upgrade_main_savepoint(true, 2017101000.02);
      }
  
      return true;
diff --cc version.php
@@@ -29,7 -29,7 +29,7 @@@
  
  defined('MOODLE_INTERNAL') || die();
  
- $version  = 2017101000.01;              // YYYYMMDD      = weekly release date of this DEV branch.
 -$version  = 2017100601.00;              // YYYYMMDD      = weekly release date of this DEV branch.
++$version  = 2017101000.02;              // YYYYMMDD      = weekly release date of this DEV branch.
                                          //         RR    = release increments - 00 in DEV branches.
                                          //           .XX = incremental changes.