function truefalse_schema in Quiz 7.5
Same name and namespace in other branches
- 8.4 question_types/truefalse/truefalse.install \truefalse_schema()
- 6.6 question_types/truefalse/truefalse.install \truefalse_schema()
- 6.4 question_types/truefalse/truefalse.install \truefalse_schema()
- 7.6 question_types/truefalse/truefalse.install \truefalse_schema()
- 7 question_types/truefalse/truefalse.install \truefalse_schema()
- 7.4 question_types/truefalse/truefalse.install \truefalse_schema()
Implements hook_schema().
File
- question_types/
truefalse/ truefalse.install, line 21 - Truefalse question install file.
Code
function truefalse_schema() {
// Extensions to nodes for T/F.
$schema['quiz_truefalse_node'] = array(
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'correct_answer' => array(
'description' => 'The correct answer for the user to give. 1 for true.',
'type' => 'int',
'unsigned' => TRUE,
'size' => 'tiny',
'default' => 0,
),
),
'primary key' => array(
'vid',
'nid',
),
);
// Place to store user answers for T/F questions.
$schema['quiz_truefalse_user_answers'] = array(
'fields' => array(
'answer_id' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'result_answer_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
),
'answer' => array(
'type' => 'int',
'unsigned' => TRUE,
'size' => 'tiny',
'default' => 0,
),
'score' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'answer_id',
),
'unique keys' => array(
'result_answer_id' => array(
'result_answer_id',
),
),
);
return $schema;
}