Commit c26b7f0c authored by Tim Hunt's avatar Tim Hunt
Browse files

MDL-20636 Fix upgrade problems. Thanks to James Brisland for his help.

parent 7916ea12
......@@ -485,7 +485,7 @@ function xmldb_local_qedatabase_install() {
// for now. We will fill in the appropriate behaviour name when
// updating all the rest of the attempt data.
$field = new xmldb_field('preferredbehaviour');
$field->set_attributes(XMLDB_TYPE_CHAR, '32', null, null, null, null, null, 'to_be_set_later', 'component');
$field->set_attributes(XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, 'to_be_set_later', 'component');
$dbman->add_field($table, $field);
// Then remove the default value, now the column is populated.
......
......@@ -266,8 +266,13 @@ function xmldb_quiz_statistics_upgrade($oldversion) {
}
if ($oldversion < 2011021500) {
$DB->set_field('quiz_reports', 'capability', 'quiz/statistics:view',
array('name' => 'statistics'));
if ($dbman->table_exists('quiz_reports')) {
$DB->set_field('quiz_reports', 'capability', 'quiz/statistics:view',
array('name' => 'statistics'));
} else {
$DB->set_field('quiz_report', 'capability', 'quiz/statistics:view',
array('name' => 'statistics'));
}
// statistics savepoint reached
upgrade_plugin_savepoint(true, 2011021500, 'quiz', 'statistics');
......
......@@ -111,7 +111,7 @@ function xmldb_qtype_match_upgrade($oldversion) {
// Define field partiallycorrectfeedback to be added to question_match
$table = new xmldb_table('question_match');
$field = new xmldb_field('partiallycorrectfeedback', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, '', 'correctfeedbackformat');
$field = new xmldb_field('partiallycorrectfeedback', XMLDB_TYPE_TEXT, 'small', null, null, null, null, 'correctfeedbackformat');
// Conditionally launch add field partiallycorrectfeedback
if (!$dbman->field_exists($table, $field)) {
......@@ -148,7 +148,7 @@ function xmldb_qtype_match_upgrade($oldversion) {
// Define field incorrectfeedback to be added to question_match
$table = new xmldb_table('question_match');
$field = new xmldb_field('incorrectfeedback', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, 'partiallycorrectfeedbackformat');
$field = new xmldb_field('incorrectfeedback', XMLDB_TYPE_TEXT, 'small', null, null, null, null, 'partiallycorrectfeedbackformat');
// Conditionally launch add field incorrectfeedback
if (!$dbman->field_exists($table, $field)) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment