Merge branch 'w39_MDL-41437_m26_mia' of https://github.com/skodak/moodle
[moodle.git] / lib / db / upgrade.php
index 4768e85..d68ce28 100644 (file)
@@ -2450,6 +2450,64 @@ function xmldb_main_upgrade($oldversion) {
         upgrade_main_savepoint(true, 2013091300.01);
     }
 
+    if ($oldversion < 2013092000.01) {
+
+        // Define table question_statistics to be created.
+        $table = new xmldb_table('question_statistics');
+
+        // Adding fields to table question_statistics.
+        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
+        $table->add_field('hashcode', XMLDB_TYPE_CHAR, '40', null, XMLDB_NOTNULL, null, null);
+        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+        $table->add_field('questionid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+        $table->add_field('slot', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+        $table->add_field('subquestion', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, null);
+        $table->add_field('s', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
+        $table->add_field('effectiveweight', XMLDB_TYPE_NUMBER, '15, 5', null, null, null, null);
+        $table->add_field('negcovar', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0');
+        $table->add_field('discriminationindex', XMLDB_TYPE_NUMBER, '15, 5', null, null, null, null);
+        $table->add_field('discriminativeefficiency', XMLDB_TYPE_NUMBER, '15, 5', null, null, null, null);
+        $table->add_field('sd', XMLDB_TYPE_NUMBER, '15, 10', null, null, null, null);
+        $table->add_field('facility', XMLDB_TYPE_NUMBER, '15, 10', null, null, null, null);
+        $table->add_field('subquestions', XMLDB_TYPE_TEXT, null, null, null, null, null);
+        $table->add_field('maxmark', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null);
+        $table->add_field('positions', XMLDB_TYPE_TEXT, null, null, null, null, null);
+        $table->add_field('randomguessscore', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null);
+
+        // Adding keys to table question_statistics.
+        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+
+        // Conditionally launch create table for question_statistics.
+        if (!$dbman->table_exists($table)) {
+            $dbman->create_table($table);
+        }
+
+        // Define table question_response_analysis to be created.
+        $table = new xmldb_table('question_response_analysis');
+
+        // Adding fields to table question_response_analysis.
+        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
+        $table->add_field('hashcode', XMLDB_TYPE_CHAR, '40', null, XMLDB_NOTNULL, null, null);
+        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+        $table->add_field('questionid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+        $table->add_field('subqid', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null);
+        $table->add_field('aid', XMLDB_TYPE_CHAR, '100', null, null, null, null);
+        $table->add_field('response', XMLDB_TYPE_TEXT, null, null, null, null, null);
+        $table->add_field('rcount', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+        $table->add_field('credit', XMLDB_TYPE_NUMBER, '15, 5', null, XMLDB_NOTNULL, null, null);
+
+        // Adding keys to table question_response_analysis.
+        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+
+        // Conditionally launch create table for question_response_analysis.
+        if (!$dbman->table_exists($table)) {
+            $dbman->create_table($table);
+        }
+
+        // Main savepoint reached.
+        upgrade_main_savepoint(true, 2013092000.01);
+    }
+
     if ($oldversion < 2013092001.01) {
         // Force uninstall of deleted tool.
         if (!file_exists("$CFG->dirroot/$CFG->admin/tool/bloglevelupgrade")) {