matching.install in Quiz 6.5
Same filename and directory in other branches
- 8.4 question_types/matching/matching.install
- 6.6 question_types/matching/matching.install
- 6.3 question_types/matching/matching.install
- 6.4 question_types/matching/matching.install
- 7.6 question_types/matching/matching.install
- 7 question_types/matching/matching.install
- 7.4 question_types/matching/matching.install
- 7.5 question_types/matching/matching.install
File
question_types/matching/matching.installView source
<?php
/*
* @file
* matching schema file.
*/
/**
* Implementation of hook_install().
*/
function matching_install() {
drupal_install_schema('matching');
}
/**
* Implementation of hook_uninstall().
*/
function matching_uninstall() {
// Delete tables
drupal_uninstall_schema('matching');
// Delete data from other tables
// Clear the cache.
cache_clear_all('variables', 'cache');
drupal_set_message(t('The Matching module has been uninstalled and related data has been deleted.'));
}
/**
* Implementation of hook_schema().
*/
function matching_schema() {
// Properties for a question nodes go in here:
$schema['quiz_matching_node'] = array(
'fields' => array(
'match_id' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'question' => array(
'type' => 'text',
'not null' => TRUE,
),
'answer' => array(
'type' => 'text',
'not null' => TRUE,
),
'feedback' => array(
'type' => 'text',
'not null' => TRUE,
),
),
'primary key' => array(
'match_id',
),
);
// User answers go in here.
$schema['quiz_matching_user_answers'] = array(
'fields' => array(
'answer_id' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'match_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'result_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'score' => array(
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'answer' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
),
'primary key' => array(
'answer_id',
),
);
return $schema;
}
Functions
Name | Description |
---|---|
matching_install | Implementation of hook_install(). |
matching_schema | Implementation of hook_schema(). |
matching_uninstall | Implementation of hook_uninstall(). |