MDL-20636 Fix upgrade problems. Thanks to James Brisland for his help.
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user