function _multichoice_alter_answers in Quiz 6.4
Same name and namespace in other branches
- 8.4 question_types/multichoice/multichoice_update_6400.inc \_multichoice_alter_answers()
- 7 question_types/multichoice/multichoice_update_6400.inc \_multichoice_alter_answers()
- 7.4 question_types/multichoice/multichoice_update_6400.inc \_multichoice_alter_answers()
We alter the quiz_multichoice_answers table to fit the new data model
Parameters
$to_return: Array where progress can be reported
$sandbox: Array where persistent data can be stored, and progress can be found
File
- question_types/
multichoice/ multichoice_update_6400.inc, line 202
Code
function _multichoice_alter_answers(&$to_return, &$sandbox = NULL) {
//db_drop_primary_key($to_return, 'quiz_multichoice_answers');
db_change_field($to_return, 'quiz_multichoice_answers', 'answer_id', 'id', array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
));
db_change_field($to_return, 'quiz_multichoice_answers', 'nid', 'question_nid', array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
));
db_change_field($to_return, 'quiz_multichoice_answers', 'vid', 'question_vid', array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
));
db_change_field($to_return, 'quiz_multichoice_answers', 'feedback', 'feedback_if_chosen', array(
'type' => 'text',
));
db_add_field($to_return, 'quiz_multichoice_answers', 'feedback_if_chosen_format', array(
'type' => 'int',
));
db_add_field($to_return, 'quiz_multichoice_answers', 'feedback_if_not_chosen', array(
'type' => 'text',
));
db_add_field($to_return, 'quiz_multichoice_answers', 'feedback_if_not_chosen_format', array(
'type' => 'int',
));
db_add_field($to_return, 'quiz_multichoice_answers', 'answer_format', array(
'type' => 'int',
));
db_change_field($to_return, 'quiz_multichoice_answers', 'is_correct', 'score_if_chosen', array(
'type' => 'int',
'unsigned' => TRUE,
'not_null' => TRUE,
'default' => 0,
));
db_add_field($to_return, 'quiz_multichoice_answers', 'score_if_not_chosen', array(
'type' => 'int',
'unsigned' => TRUE,
'not_null' => TRUE,
'default' => 0,
));
db_drop_field($to_return, 'quiz_multichoice_answers', 'result_option');
}