mirror of
https://github.com/moodle/moodle.git
synced 2025-02-10 10:41:57 +01:00
MDL-10110 dropping multichoice field in question_calculated_options table
This commit is contained in:
parent
c09e1a2cb7
commit
c9acc7728f
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="question/type/calculated/db" VERSION="20090921" COMMENT="XMLDB file for Moodle question/type/calculated. This question type also relies on the question_numerical_units table created by the numerical question type, and the tables created by the datasetdependent question type base class."
|
||||
<XMLDB PATH="question/type/calculated/db" VERSION="20100208" COMMENT="XMLDB file for Moodle question/type/calculated. This question type also relies on the question_numerical_units table created by the numerical question type, and the tables created by the datasetdependent question type base class."
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
@ -26,9 +26,8 @@
|
||||
<FIELDS>
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="question"/>
|
||||
<FIELD NAME="question" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="synchronize"/>
|
||||
<FIELD NAME="synchronize" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="question" NEXT="multiplechoice"/>
|
||||
<FIELD NAME="multiplechoice" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="set for multiple choice calculated question" PREVIOUS="synchronize" NEXT="single"/>
|
||||
<FIELD NAME="single" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" COMMENT="If 0 it multiple response (checkboxes). Otherwise it is radio buttons." PREVIOUS="multiplechoice" NEXT="shuffleanswers"/>
|
||||
<FIELD NAME="synchronize" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="question" NEXT="single"/>
|
||||
<FIELD NAME="single" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" COMMENT="If 0 it multiple response (checkboxes). Otherwise it is radio buttons." PREVIOUS="synchronize" NEXT="shuffleanswers"/>
|
||||
<FIELD NAME="shuffleanswers" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" COMMENT="Whether the choices can be randomly shuffled." PREVIOUS="single" NEXT="correctfeedback"/>
|
||||
<FIELD NAME="correctfeedback" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" COMMENT="Feedback shown for any correct response." PREVIOUS="shuffleanswers" NEXT="partiallycorrectfeedback"/>
|
||||
<FIELD NAME="partiallycorrectfeedback" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" COMMENT="Feedback shown for any partially correct response." PREVIOUS="correctfeedback" NEXT="incorrectfeedback"/>
|
||||
|
@ -61,16 +61,17 @@ function xmldb_qtype_calculated_upgrade($oldversion) {
|
||||
if ( $result && $oldversion < 2009092000 ) { //New version in version.php
|
||||
|
||||
/// Define field multichoice to be added to question_calculated_options
|
||||
$table = new xmldb_table('question_calculated_options');
|
||||
$field = new xmldb_field('multichoice', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'synchronize');
|
||||
///ALTER TABLE `moodle`.`mdl_question_calculated_options` DROP COLUMN `multichoice`;
|
||||
// $table = new xmldb_table('question_calculated_options');
|
||||
// $field = new xmldb_field('multichoice', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'synchronize');
|
||||
|
||||
/// Conditionally launch add field multichoice
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
// if (!$dbman->field_exists($table, $field)) {
|
||||
// $dbman->add_field($table, $field);
|
||||
// }
|
||||
/// Define field single to be added to question_calculated_options
|
||||
$table = new xmldb_table('question_calculated_options');
|
||||
$field = new xmldb_field('single', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0', 'multichoice');
|
||||
$field = new xmldb_field('single', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0', 'synchronize');
|
||||
|
||||
/// Conditionally launch add field single
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
@ -119,10 +120,22 @@ function xmldb_qtype_calculated_upgrade($oldversion) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
upgrade_plugin_savepoint($result, 2009092000, 'qtype', 'calculated');
|
||||
|
||||
|
||||
}
|
||||
|
||||
if ($result && $oldversion < 2010020800) {
|
||||
|
||||
/// Define field multiplechoice to be dropped from question_calculated_options
|
||||
$table = new xmldb_table('question_calculated_options');
|
||||
$field = new xmldb_field('multichoice');
|
||||
|
||||
/// Conditionally launch drop field multiplechoice
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
$dbman->drop_field($table, $field);
|
||||
}
|
||||
|
||||
/// calculated savepoint reached
|
||||
upgrade_plugin_savepoint($result, 2010020800, 'qtype', 'calculated');
|
||||
}
|
||||
/// calculated savepoint reached
|
||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
||||
/// $result = result of database_manager methods
|
||||
|
Loading…
x
Reference in New Issue
Block a user