Merge branch 'MDL-52781-master' of git://github.com/lameze/moodle
authorAndrew Nicols <andrew@nicols.co.uk>
Thu, 21 Apr 2016 07:43:35 +0000 (15:43 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Thu, 21 Apr 2016 07:54:45 +0000 (15:54 +0800)
1  2 
auth/db/upgrade.txt
lib/db/upgrade.php
user/lib.php
version.php

@@@ -1,6 -1,6 +1,12 @@@
  This files describes API changes in /auth/db/*,
  information provided here is intended especially for developers.
  
++=== 3.1 ===
++
++* The auth_plugin_db::clean_data() has been deprecated and will be removed
++  in a future version. Please update to use core_user::clean_data()
++  instead.
++
  === 2.9 ===
  
  Some alterations have been made to the handling of case sensitity handling of passwords
@@@ -1464,540 -1464,11 +1464,546 @@@ function xmldb_main_upgrade($oldversion
          upgrade_main_savepoint(true, 2016030400.01);
      }
  
 -    if ($oldversion < 2016040700.01) {
 +    if ($oldversion < 2016041500.50) {
 +
 +        // Define table competency to be created.
 +        $table = new xmldb_table('competency');
 +
 +        // Adding fields to table competency.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('shortname', XMLDB_TYPE_CHAR, '100', null, null, null, null);
 +        $table->add_field('description', XMLDB_TYPE_TEXT, null, null, null, null, null);
 +        $table->add_field('descriptionformat', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0');
 +        $table->add_field('idnumber', XMLDB_TYPE_CHAR, '100', null, null, null, null);
 +        $table->add_field('competencyframeworkid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('parentid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
 +        $table->add_field('path', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('sortorder', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('ruletype', XMLDB_TYPE_CHAR, '100', null, null, null, null);
 +        $table->add_field('ruleoutcome', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0');
 +        $table->add_field('ruleconfig', XMLDB_TYPE_TEXT, null, null, null, null, null);
 +        $table->add_field('scaleid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
 +        $table->add_field('scaleconfiguration', XMLDB_TYPE_TEXT, null, null, null, null, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
 +
 +        // Adding keys to table competency.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +
 +        // Adding indexes to table competency.
 +        $table->add_index('idnumberframework', XMLDB_INDEX_UNIQUE, array('competencyframeworkid', 'idnumber'));
 +        $table->add_index('ruleoutcome', XMLDB_INDEX_NOTUNIQUE, array('ruleoutcome'));
 +
 +        // Conditionally launch create table for competency.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2016041500.50);
 +    }
 +
 +    if ($oldversion < 2016041500.51) {
 +
 +        // Define table competency_coursecompsetting to be created.
 +        $table = new xmldb_table('competency_coursecompsetting');
 +
 +        // Adding fields to table competency_coursecompsetting.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('courseid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('pushratingstouserplans', XMLDB_TYPE_INTEGER, '2', null, null, null, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
 +
 +        // Adding keys to table competency_coursecompsetting.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +        $table->add_key('courseidlink', XMLDB_KEY_FOREIGN_UNIQUE, array('courseid'), 'course', array('id'));
 +
 +        // Conditionally launch create table for competency_coursecompsetting.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2016041500.51);
 +    }
 +
 +    if ($oldversion < 2016041500.52) {
 +
 +        // Define table competency_framework to be created.
 +        $table = new xmldb_table('competency_framework');
 +
 +        // Adding fields to table competency_framework.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('shortname', XMLDB_TYPE_CHAR, '100', null, null, null, null);
 +        $table->add_field('contextid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('idnumber', XMLDB_TYPE_CHAR, '100', null, null, null, null);
 +        $table->add_field('description', XMLDB_TYPE_TEXT, null, null, null, null, null);
 +        $table->add_field('descriptionformat', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0');
 +        $table->add_field('scaleid', XMLDB_TYPE_INTEGER, '11', null, null, null, null);
 +        $table->add_field('scaleconfiguration', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('visible', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '1');
 +        $table->add_field('taxonomies', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
 +
 +        // Adding keys to table competency_framework.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +
 +        // Adding indexes to table competency_framework.
 +        $table->add_index('idnumber', XMLDB_INDEX_UNIQUE, array('idnumber'));
 +
 +        // Conditionally launch create table for competency_framework.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2016041500.52);
 +    }
 +
 +    if ($oldversion < 2016041500.53) {
 +
 +        // Define table competency_coursecomp to be created.
 +        $table = new xmldb_table('competency_coursecomp');
 +
 +        // Adding fields to table competency_coursecomp.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('courseid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('ruleoutcome', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('sortorder', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +
 +        // Adding keys to table competency_coursecomp.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +        $table->add_key('courseidlink', XMLDB_KEY_FOREIGN, array('courseid'), 'course', array('id'));
 +        $table->add_key('competencyid', XMLDB_KEY_FOREIGN, array('competencyid'), 'competency_competency', array('id'));
 +
 +        // Adding indexes to table competency_coursecomp.
 +        $table->add_index('courseidruleoutcome', XMLDB_INDEX_NOTUNIQUE, array('courseid', 'ruleoutcome'));
 +        $table->add_index('courseidcompetencyid', XMLDB_INDEX_UNIQUE, array('courseid', 'competencyid'));
 +
 +        // Conditionally launch create table for competency_coursecomp.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2016041500.53);
 +    }
 +
 +    if ($oldversion < 2016041500.54) {
 +
 +        // Define table competency_plan to be created.
 +        $table = new xmldb_table('competency_plan');
 +
 +        // Adding fields to table competency_plan.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('name', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('description', XMLDB_TYPE_TEXT, null, null, null, null, null);
 +        $table->add_field('descriptionformat', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0');
 +        $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('templateid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
 +        $table->add_field('origtemplateid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
 +        $table->add_field('status', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('duedate', XMLDB_TYPE_INTEGER, '10', null, null, null, '0');
 +        $table->add_field('reviewerid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
 +        $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +
 +        // Adding keys to table competency_plan.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +
 +        // Adding indexes to table competency_plan.
 +        $table->add_index('useridstatus', XMLDB_INDEX_NOTUNIQUE, array('userid', 'status'));
 +        $table->add_index('templateid', XMLDB_INDEX_NOTUNIQUE, array('templateid'));
 +        $table->add_index('statusduedate', XMLDB_INDEX_NOTUNIQUE, array('status', 'duedate'));
 +
 +        // Conditionally launch create table for competency_plan.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2016041500.54);
 +    }
 +
 +    if ($oldversion < 2016041500.55) {
 +
 +        // Define table competency_template to be created.
 +        $table = new xmldb_table('competency_template');
 +
 +        // Adding fields to table competency_template.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('shortname', XMLDB_TYPE_CHAR, '100', null, null, null, null);
 +        $table->add_field('contextid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('description', XMLDB_TYPE_TEXT, null, null, null, null, null);
 +        $table->add_field('descriptionformat', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0');
 +        $table->add_field('visible', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '1');
 +        $table->add_field('duedate', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
 +
 +        // Adding keys to table competency_template.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +
 +        // Conditionally launch create table for competency_template.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2016041500.55);
 +    }
 +
 +    if ($oldversion < 2016041500.56) {
 +
 +        // Define table competency_templatecomp to be created.
 +        $table = new xmldb_table('competency_templatecomp');
 +
 +        // Adding fields to table competency_templatecomp.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('templateid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('sortorder', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
 +
 +        // Adding keys to table competency_templatecomp.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +        $table->add_key('templateidlink', XMLDB_KEY_FOREIGN, array('templateid'), 'competency_template', array('id'));
 +        $table->add_key('competencyid', XMLDB_KEY_FOREIGN, array('competencyid'), 'competency_competency', array('id'));
 +
 +        // Conditionally launch create table for competency_templatecomp.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2016041500.56);
 +    }
 +
 +    if ($oldversion < 2016041500.57) {
 +
 +        // Define table competency_templatecohort to be created.
 +        $table = new xmldb_table('competency_templatecohort');
 +
 +        // Adding fields to table competency_templatecohort.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('templateid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('cohortid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +
 +        // Adding keys to table competency_templatecohort.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +
 +        // Adding indexes to table competency_templatecohort.
 +        $table->add_index('templateid', XMLDB_INDEX_NOTUNIQUE, array('templateid'));
 +        $table->add_index('templatecohortids', XMLDB_INDEX_UNIQUE, array('templateid', 'cohortid'));
 +
 +        // Conditionally launch create table for competency_templatecohort.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2016041500.57);
 +    }
 +
 +    if ($oldversion < 2016041500.58) {
 +
 +        // Define table competency_relatedcomp to be created.
 +        $table = new xmldb_table('competency_relatedcomp');
 +
 +        // Adding fields to table competency_relatedcomp.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('relatedcompetencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
 +        $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +
 +        // Adding keys to table competency_relatedcomp.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +
 +        // Conditionally launch create table for competency_relatedcomp.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2016041500.58);
 +    }
 +
 +    if ($oldversion < 2016041500.59) {
 +
 +        // Define table competency_usercomp to be created.
 +        $table = new xmldb_table('competency_usercomp');
 +
 +        // Adding fields to table competency_usercomp.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('status', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0');
 +        $table->add_field('reviewerid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
 +        $table->add_field('proficiency', XMLDB_TYPE_INTEGER, '2', null, null, null, null);
 +        $table->add_field('grade', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
 +        $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +
 +        // Adding keys to table competency_usercomp.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +
 +        // Adding indexes to table competency_usercomp.
 +        $table->add_index('useridcompetency', XMLDB_INDEX_UNIQUE, array('userid', 'competencyid'));
 +
 +        // Conditionally launch create table for competency_usercomp.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2016041500.59);
 +    }
 +
 +    if ($oldversion < 2016041500.60) {
 +
 +        // Define table competency_usercompcourse to be created.
 +        $table = new xmldb_table('competency_usercompcourse');
 +
 +        // Adding fields to table competency_usercompcourse.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('courseid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('proficiency', XMLDB_TYPE_INTEGER, '2', null, null, null, null);
 +        $table->add_field('grade', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
 +        $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +
 +        // Adding keys to table competency_usercompcourse.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +
 +        // Adding indexes to table competency_usercompcourse.
 +        $table->add_index('useridcoursecomp', XMLDB_INDEX_UNIQUE, array('userid', 'courseid', 'competencyid'));
 +
 +        // Conditionally launch create table for competency_usercompcourse.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2016041500.60);
 +    }
 +
 +    if ($oldversion < 2016041500.61) {
 +
 +        // Define table competency_usercompplan to be created.
 +        $table = new xmldb_table('competency_usercompplan');
 +
 +        // Adding fields to table competency_usercompplan.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('planid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('proficiency', XMLDB_TYPE_INTEGER, '2', null, null, null, null);
 +        $table->add_field('grade', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
 +        $table->add_field('sortorder', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
 +        $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +
 +        // Adding keys to table competency_usercompplan.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +
 +        // Adding indexes to table competency_usercompplan.
 +        $table->add_index('usercompetencyplan', XMLDB_INDEX_UNIQUE, array('userid', 'competencyid', 'planid'));
 +
 +        // Conditionally launch create table for competency_usercompplan.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2016041500.61);
 +    }
 +
 +    if ($oldversion < 2016041500.62) {
 +
 +        // Define table competency_plancomp to be created.
 +        $table = new xmldb_table('competency_plancomp');
 +
 +        // Adding fields to table competency_plancomp.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('planid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('sortorder', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
 +        $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +
 +        // Adding keys to table competency_plancomp.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +
 +        // Adding indexes to table competency_plancomp.
 +        $table->add_index('planidcompetencyid', XMLDB_INDEX_UNIQUE, array('planid', 'competencyid'));
 +
 +        // Conditionally launch create table for competency_plancomp.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2016041500.62);
 +    }
 +
 +    if ($oldversion < 2016041500.63) {
 +
 +        // Define table competency_evidence to be created.
 +        $table = new xmldb_table('competency_evidence');
 +
 +        // Adding fields to table competency_evidence.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('usercompetencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('contextid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('action', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('actionuserid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
 +        $table->add_field('descidentifier', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('desccomponent', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('desca', XMLDB_TYPE_TEXT, null, null, null, null, null);
 +        $table->add_field('url', XMLDB_TYPE_CHAR, '255', null, null, null, null);
 +        $table->add_field('grade', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
 +        $table->add_field('note', XMLDB_TYPE_TEXT, null, null, null, null, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +
 +        // Adding keys to table competency_evidence.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +
 +        // Adding indexes to table competency_evidence.
 +        $table->add_index('usercompetencyid', XMLDB_INDEX_NOTUNIQUE, array('usercompetencyid'));
 +
 +        // Conditionally launch create table for competency_evidence.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2016041500.63);
 +    }
 +
 +    if ($oldversion < 2016041500.64) {
 +
 +        // Define table competency_userevidence to be created.
 +        $table = new xmldb_table('competency_userevidence');
 +
 +        // Adding fields to table competency_userevidence.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('name', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('description', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('descriptionformat', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('url', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +
 +        // Adding keys to table competency_userevidence.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +
 +        // Adding indexes to table competency_userevidence.
 +        $table->add_index('userid', XMLDB_INDEX_NOTUNIQUE, array('userid'));
 +
 +        // Conditionally launch create table for competency_userevidence.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2016041500.64);
 +    }
 +
 +    if ($oldversion < 2016041500.65) {
 +
 +        // Define table competency_userevidencecomp to be created.
 +        $table = new xmldb_table('competency_userevidencecomp');
 +
 +        // Adding fields to table competency_userevidencecomp.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('userevidenceid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +
 +        // Adding keys to table competency_userevidencecomp.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +
 +        // Adding indexes to table competency_userevidencecomp.
 +        $table->add_index('userevidenceid', XMLDB_INDEX_NOTUNIQUE, array('userevidenceid'));
 +        $table->add_index('userevidencecompids', XMLDB_INDEX_UNIQUE, array('userevidenceid', 'competencyid'));
 +
 +        // Conditionally launch create table for competency_userevidencecomp.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2016041500.65);
 +    }
 +
 +    if ($oldversion < 2016041500.66) {
 +
 +        // Define table competency_modulecomp to be created.
 +        $table = new xmldb_table('competency_modulecomp');
 +
 +        // Adding fields to table competency_modulecomp.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('cmid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('sortorder', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('ruleoutcome', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, null);
 +
 +        // Adding keys to table competency_modulecomp.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +        $table->add_key('cmidkey', XMLDB_KEY_FOREIGN, array('cmid'), 'course_modules', array('id'));
 +        $table->add_key('competencyidkey', XMLDB_KEY_FOREIGN, array('competencyid'), 'competency_competency', array('id'));
 +
 +        // Adding indexes to table competency_modulecomp.
 +        $table->add_index('cmidruleoutcome', XMLDB_INDEX_NOTUNIQUE, array('cmid', 'ruleoutcome'));
 +        $table->add_index('cmidcompetencyid', XMLDB_INDEX_UNIQUE, array('cmid', 'competencyid'));
 +
 +        // Conditionally launch create table for competency_modulecomp.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2016041500.66);
 +    }
 +
++    if ($oldversion < 2016042100.00) {
+         // Update all countries to upper case.
+         $DB->execute("UPDATE {user} SET country = UPPER(country)");
+         // Main savepoint reached.
 -        upgrade_main_savepoint(true, 2016040700.01);
++        upgrade_main_savepoint(true, 2016042100.00);
+     }
      return true;
  }
diff --cc user/lib.php
Simple merge
diff --cc version.php
@@@ -29,7 -29,7 +29,7 @@@
  
  defined('MOODLE_INTERNAL') || die();
  
- $version  = 2016041500.67;              // YYYYMMDD      = weekly release date of this DEV branch.
 -$version  = 2016041500.00;              // YYYYMMDD      = weekly release date of this DEV branch.
++$version  = 2016042100.00;              // YYYYMMDD      = weekly release date of this DEV branch.
                                          //         RR    = release increments - 00 in DEV branches.
                                          //           .XX = incremental changes.