Newer
Older
/**
* @file
* Describes Question tables
*/
function question_schema() {
$schema['question_queue'] = array(
'fields' => array(
'qid' => array('type' => 'serial', 'not null' => TRUE, 'disp-width' => '10'),
'questioner' => array('type' => 'varchar', 'length' => '50', 'not null' => TRUE, 'default' => ''),
'quid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'),
'question' => array('type' => 'text', 'not null' => TRUE)),
'primary key' => array('qid'),
);
$schema['question_node'] = array(
'fields' => array(
'nid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'),
'questioner' => array('type' => 'varchar', 'length' => '50', 'not null' => TRUE, 'default' => ''),
'quid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'),
'question' => array('type' => 'text', 'size' => 'big', 'not null' => TRUE),
'q_format' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'disp-width' => '4'),
'answer' => array('type' => 'text', 'size' => 'big', 'not null' => TRUE),
'a_format' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'disp-width' => '4')),
'primary key' => array('nid'),
);
return $schema;
}
drupal_install_schema('question');
db_add_primary_key($ret, 'question_node', array('nid'));
db_add_primary_key($ret, 'question_queue', array('qid'));
return $ret;
}
function question_update_6001() {
$ret = array();
db_drop_primary_key($ret, 'question_queue');
return $ret;
}
function question_update_6002() {
$ret = array();
db_change_field(
$ret, //Results
'question_queue', //Table name
'qid', //Old column name
'qid', //New column name
array('type' => 'serial', 'not null' => TRUE), //Field spec
array('primary key' => array('qid')) //Index spec
);
return $ret;
drupal_uninstall_schema('question');
variable_del('question_require_registered');
variable_del('question_thanks');
}