View source
<?php
function feedback_schema() {
$schema['feedback'] = array(
'description' => t('Stores all feedback messages.'),
'fields' => array(
'fid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => t('The primary identifier for a feedback message.'),
),
'uid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => t('The user id of the author of a feedback message.'),
),
'status' => array(
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => t('The status of a feedback message.'),
),
'message' => array(
'type' => 'text',
'size' => 'big',
'not null' => TRUE,
'description' => t('The actual feedback message.'),
),
'location' => array(
'type' => 'text',
'not null' => TRUE,
'description' => t('The internal Drupal path of the page the feedback message was submitted on.'),
),
'location_masked' => array(
'type' => 'text',
'not null' => TRUE,
'description' => t('The masked Drupal path of the page the feedback message was submitted on.'),
),
'url' => array(
'type' => 'text',
'not null' => TRUE,
'description' => t('The absolute URL of the page the feedback message was submitted on.'),
),
'useragent' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'description' => t('The user agent of the feedback message author.'),
),
'timestamp' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => t('The UNIX timestamp when the feedback message was created.'),
),
),
'primary key' => array(
'fid',
),
'indexes' => array(
'location' => array(
array(
'location',
32,
),
),
'location_masked' => array(
array(
'location_masked',
32,
),
),
),
);
return $schema;
}
function feedback_install() {
drupal_install_schema('feedback');
}
function feedback_uninstall() {
drupal_uninstall_schema('feedback');
db_query("DELETE FROM {variable} WHERE name LIKE 'feedback_%%'");
}
function feedback_update_6100() {
$ret = array();
db_drop_primary_key($ret, 'feedback');
db_change_field($ret, 'feedback', 'fid', 'fid', array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
), array(
'primary key' => array(
'fid',
),
));
return $ret;
}
function feedback_update_6101() {
$ret = array();
db_add_field($ret, 'feedback', 'url', array(
'type' => 'text',
'not null' => TRUE,
));
$ret[] = update_sql("UPDATE {feedback} SET url = location");
return $ret;
}