Merge branch 'MDL-59265_master' of git://github.com/dmonllao/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 28 Aug 2017 23:16:42 +0000 (01:16 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 28 Aug 2017 23:16:42 +0000 (01:16 +0200)
1  2 
lib/db/install.xml
lib/db/upgrade.php
version.php

Simple merge
@@@ -2369,59 -2369,18 +2369,72 @@@ function xmldb_main_upgrade($oldversion
          upgrade_main_savepoint(true, 2017082300.01);
      }
  
 -    if ($oldversion < 2017082300.02) {
 +    if ($oldversion < 2017082500.00) {
 +        // Handle FKs for the table 'analytics_models_log'.
 +        $table = new xmldb_table('analytics_models_log');
 +
 +        // Remove the existing index before adding FK (which creates an index).
 +        $index = new xmldb_index('modelid', XMLDB_INDEX_NOTUNIQUE, array('modelid'));
 +
 +        // Conditionally launch drop index.
 +        if ($dbman->index_exists($table, $index)) {
 +            $dbman->drop_index($table, $index);
 +        }
 +
 +        // Now, add the FK.
 +        $key = new xmldb_key('modelid', XMLDB_KEY_FOREIGN, array('modelid'), 'analytics_models', array('id'));
 +        $dbman->add_key($table, $key);
 +
 +        // Handle FKs for the table 'analytics_predictions'.
 +        $table = new xmldb_table('analytics_predictions');
 +        $key = new xmldb_key('modelid', XMLDB_KEY_FOREIGN, array('modelid'), 'analytics_models', array('id'));
 +        $dbman->add_key($table, $key);
 +
 +        $key = new xmldb_key('contextid', XMLDB_KEY_FOREIGN, array('contextid'), 'context', array('id'));
 +        $dbman->add_key($table, $key);
 +
 +        // Handle FKs for the table 'analytics_train_samples'.
 +        $table = new xmldb_table('analytics_train_samples');
 +        $key = new xmldb_key('modelid', XMLDB_KEY_FOREIGN, array('modelid'), 'analytics_models', array('id'));
 +        $dbman->add_key($table, $key);
 +
 +        $key = new xmldb_key('fileid', XMLDB_KEY_FOREIGN, array('fileid'), 'files', array('id'));
 +        $dbman->add_key($table, $key);
 +
 +        // Handle FKs for the table 'analytics_predict_samples'.
 +        $table = new xmldb_table('analytics_predict_samples');
 +        $key = new xmldb_key('modelid', XMLDB_KEY_FOREIGN, array('modelid'), 'analytics_models', array('id'));
 +        $dbman->add_key($table, $key);
 +
 +        // Handle FKs for the table 'analytics_used_files'.
 +        $table = new xmldb_table('analytics_used_files');
 +        $key = new xmldb_key('modelid', XMLDB_KEY_FOREIGN, array('modelid'), 'analytics_models', array('id'));
 +        $dbman->add_key($table, $key);
 +
 +        $key = new xmldb_key('fileid', XMLDB_KEY_FOREIGN, array('fileid'), 'files', array('id'));
 +        $dbman->add_key($table, $key);
 +
 +        // Handle FKs for the table 'analytics_indicator_calc'.
 +        $table = new xmldb_table('analytics_indicator_calc');
 +        $key = new xmldb_key('contextid', XMLDB_KEY_FOREIGN, array('contextid'), 'context', array('id'));
 +        $dbman->add_key($table, $key);
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2017082500.00);
 +    }
 +
++    if ($oldversion < 2017082800.00) {
+         // Changing type of field prediction on table analytics_predictions to number.
+         $table = new xmldb_table('analytics_predictions');
+         $field = new xmldb_field('prediction', XMLDB_TYPE_NUMBER, '10, 2', null, XMLDB_NOTNULL, null, null, 'rangeindex');
+         // Launch change of type for field prediction.
+         $dbman->change_field_type($table, $field);
+         // Main savepoint reached.
 -        upgrade_main_savepoint(true, 2017082300.02);
++        upgrade_main_savepoint(true, 2017082800.00);
+     }
      return true;
  }
diff --cc version.php
@@@ -29,7 -29,7 +29,7 @@@
  
  defined('MOODLE_INTERNAL') || die();
  
- $version  = 2017082500.00;              // YYYYMMDD      = weekly release date of this DEV branch.
 -$version  = 2017082300.02;              // YYYYMMDD      = weekly release date of this DEV branch.
++$version  = 2017082800.00;              // YYYYMMDD      = weekly release date of this DEV branch.
                                          //         RR    = release increments - 00 in DEV branches.
                                          //           .XX = incremental changes.