<FIELD NAME="correctfeedback" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="shuffleanswers" NEXT="partiallycorrectfeedback"/>
<FIELD NAME="partiallycorrectfeedback" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="correctfeedback" NEXT="incorrectfeedback"/>
<FIELD NAME="incorrectfeedback" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="partiallycorrectfeedback" NEXT="answernumbering"/>
- <FIELD NAME="answernumbering" TYPE="char" LENGTH="10" NOTNULL="true" DEFAULT="abc" SEQUENCE="false" ENUM="true" ENUMVALUES="'abc', 'ABC', '123', 'none'" COMMENT="Indicates how and whether the choices should be numbered." PREVIOUS="incorrectfeedback"/>
+ <FIELD NAME="answernumbering" TYPE="char" LENGTH="10" NOTNULL="true" DEFAULT="abc" SEQUENCE="false" ENUM="false" COMMENT="Indicates how and whether the choices should be numbered." PREVIOUS="incorrectfeedback"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for question_multichoice" NEXT="question"/>
// with a defaultgrade of 1, when it shoud be 0. We need to reset them all to 0.
// See MDL-7925.
if ($result && $oldversion < 2006121500) {
- $result = set_field('question', 'defaultgrade', 0,
+ $result = $result && set_field('question', 'defaultgrade', 0,
'qtype', DESCRIPTION, 'defaultgrade', 1);
}
- // Add a field so that question authors can choose whether and how the
- // Choices are numbered.
+ // Add a field so that question authors can choose whether and how the Choices are numbered.
+ // Subsequently changed to not create an enum constraint, because it was causing problems -
+ // See 2007081700 update.
if ($result && $oldversion < 2007041300) {
$table = new XMLDBTable('question_multichoice');
$field = new XMLDBField('answernumbering');
- $field->setAttributes(XMLDB_TYPE_CHAR, '10', null, XMLDB_NOTNULL, null, XMLDB_ENUM, array('abc', 'ABC', '123', 'none'), 'abc', 'incorrectfeedback');
+ $field->setAttributes(XMLDB_TYPE_CHAR, '10', null, XMLDB_NOTNULL, null, null, null, 'abc', 'incorrectfeedback');
$result = $result && add_field($table, $field);
}
// with a defaultgrade of 1, when it shoud be 0. We need to reset them all to 0.
// This is re-occurrence of MDL-7925, so we need to do it again.
if ($result && $oldversion < 2007072000) {
- $result = set_field('question', 'defaultgrade', 0,
+ $result = $result && set_field('question', 'defaultgrade', 0,
'qtype', DESCRIPTION, 'defaultgrade', 1);
}
+ // Drop enum constraint on 'answernumbering' column, and change ABC to ABCD becuase MySQL
+ // sometimes can't cope with things that differ only by case.
+ if ($result && $oldversion < 2007081700) {
+ if ($result && $oldversion >= 2007041300) {
+ $table = new XMLDBTable('question_multichoice');
+ $field = new XMLDBField('answernumbering');
+ $field->setAttributes(XMLDB_TYPE_CHAR, '10', null, XMLDB_NOTNULL, null, null, null, 'abc', 'incorrectfeedback');
+ $result = $result && change_field_enum($table, $field);
+ }
+ $result = $result && set_field('question_multichoice', 'answernumbering', 'ABCD', 'answernumbering', 'ABC');
+ }
+
return $result;
}