function quiz_update_7523 in Quiz 7.5
Add type for quiz results.
File
- ./
quiz.install, line 1282 - Quiz install schema for installing the quiz module.
Code
function quiz_update_7523() {
db_create_table('quiz_result_type', array(
'description' => 'Stores information about all defined quiz result types.',
'fields' => array(
'id' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Unique result type ID.',
),
'type' => array(
'description' => 'The machine-readable name of this result type.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
),
'label' => array(
'description' => 'The human-readable name of this result type.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'status' => array(
'type' => 'int',
'not null' => TRUE,
// Set the default to ENTITY_CUSTOM without using the constant as it is
// not safe to use it at this point.
'default' => 0x1,
'size' => 'tiny',
'description' => 'The exportable status of the entity.',
),
'module' => array(
'description' => 'The name of the providing module if the entity has been defined in code.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
),
),
'primary key' => array(
'id',
),
'unique keys' => array(
'type' => array(
'type',
),
),
));
db_add_field('quiz_node_properties', 'result_type', array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'The result bundle.',
));
db_add_field('quiz_node_results', 'type', array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'The result bundle.',
));
db_update('quiz_node_properties')
->fields(array(
'result_type' => 'quiz_result',
))
->execute();
db_update('quiz_node_results')
->fields(array(
'type' => 'quiz_result',
))
->execute();
db_insert('quiz_result_type')
->fields(array(
'label' => 'Quiz result',
'type' => 'quiz_result',
))
->execute();
return t('Added quiz result bundle table and column.');
}