function quiz_update_6420 in Quiz 6.4
Implementation of hook_update_N
Makes sure max_score is correct in the quiz_node_properties
File
- ./
quiz.install, line 58 - Quiz install schema for installing the quiz module
Code
function quiz_update_6420() {
$results = array();
db_create_table($results, 'quiz_terms', array(
'description' => 'Table storing what terms belongs to what quiz for categorized random quizzes',
'fields' => array(
'nid' => array(
'description' => 'Node id',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'vid' => array(
'description' => 'Version id',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'weight' => array(
'description' => 'The terms weight decides the order of the terms',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'tid' => array(
'description' => 'Term id',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'max_score' => array(
'description' => 'Max score for each question marked with this term',
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
),
'number' => array(
'description' => 'Number of questions to be drawn from this term',
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
),
),
'primary key' => array(
'vid',
'tid',
),
'indexes' => array(
'version' => array(
'vid',
),
),
));
$field = array(
'type' => 'int',
'size' => 'tiny',
'unsigned' => FALSE,
'not null' => TRUE,
'default' => 1,
);
db_add_field($results, 'quiz_node_properties', 'allow_resume', $field);
db_add_field($results, 'quiz_user_settings', 'allow_resume', $field);
$field['default'] = 0;
db_add_field($results, 'quiz_node_properties', 'allow_jumping', $field);
db_add_field($results, 'quiz_user_settings', 'allow_jumping', $field);
db_add_field($results, 'quiz_node_results_answers', 'number', $field);
db_add_field($results, 'quiz_node_results_answers', 'tid', array(
'type' => 'int',
'unsigned' => TRUE,
));
return $results;
}