You are here

function _multichoice_alter_user_answers1 in Quiz 6.4

Same name and namespace in other branches
  1. 8.4 question_types/multichoice/multichoice_update_6400.inc \_multichoice_alter_user_answers1()
  2. 7 question_types/multichoice/multichoice_update_6400.inc \_multichoice_alter_user_answers1()
  3. 7.4 question_types/multichoice/multichoice_update_6400.inc \_multichoice_alter_user_answers1()

Alter and create tables to store user answers

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 50

Code

function _multichoice_alter_user_answers1(&$to_return, &$sandbox = NULL) {
  db_drop_primary_key($to_return, 'quiz_multichoice_user_answers');
  db_add_field($to_return, 'quiz_multichoice_user_answers', 'id', array(
    'type' => 'serial',
    'unsignet' => TRUE,
    'not_null' => TRUE,
  ), array(
    'primary key' => array(
      'id',
    ),
  ));
  db_add_field($to_return, 'quiz_multichoice_user_answers', 'choice_order', array(
    'type' => 'text',
  ));
  db_create_table($to_return, 'quiz_multichoice_user_answer_multi', array(
    'fields' => array(
      'user_answer_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'answer_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'user_answer_id',
      'answer_id',
    ),
  ));
}