| 1 |
<?php
|
| 2 |
// $Id: shoutbox.install,v 1.1.2.2 2007/10/18 06:39:17 disterics Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Shoutbox module install file.
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Define the 'shoutbox' and 'shoutbox_moderation' table structures.
|
| 11 |
*
|
| 12 |
* @return
|
| 13 |
* The schema which contains the structure for the shoutbox module's tables.
|
| 14 |
*/
|
| 15 |
function shoutbox_schema() {
|
| 16 |
$schema['shoutbox'] = array(
|
| 17 |
'description' => t('A table containing the shoutbox posts.'),
|
| 18 |
'fields' => array(
|
| 19 |
'shout_id' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'description' => t('The primary identifier for the shout post.')),
|
| 20 |
'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => t('The primary identifier for the shout post author.')),
|
| 21 |
'nick' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'description' => t('The author\'s nickname.')),
|
| 22 |
'shout' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'description' => t('The shout post.')),
|
| 23 |
'url' => array('type' => 'varchar', 'length' => 100, 'not null' => TRUE, 'description' => t('The url of the post.')),
|
| 24 |
'status' => array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 0, 'description' => t('The shout\'s status.')),
|
| 25 |
'moderate' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'description' => t('The moderation id.')),
|
| 26 |
'created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'description' => t('Creation date.')),
|
| 27 |
'changed' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'description' => t('Last updated date.')),
|
| 28 |
'hostname' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'description' => t('The hostname where the post originated.')),
|
| 29 |
),
|
| 30 |
'primary key' => array('shout_id'),
|
| 31 |
);
|
| 32 |
|
| 33 |
$schema['shoutbox_moderation'] = array(
|
| 34 |
'description' => t('A table keeping track of the moderation votes.'),
|
| 35 |
'fields' => array(
|
| 36 |
'moderation_id' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'description' => t('The primary identifier for the moderation.')),
|
| 37 |
'shout_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => t('The primary identifier for the shout post.')),
|
| 38 |
'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => t('The primary identifier for the shout post author.')),
|
| 39 |
'vote' => array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 0, 'description' => t('The moderator\'s vote.')),
|
| 40 |
'timestamp' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => t('Last updated date.')),
|
| 41 |
),
|
| 42 |
'indexes' => array(
|
| 43 |
'moderation_id' => array('moderation_id'),
|
| 44 |
),
|
| 45 |
'primary key' => array('moderation_id'),
|
| 46 |
);
|
| 47 |
|
| 48 |
return $schema;
|
| 49 |
}
|
| 50 |
|
| 51 |
function shoutbox_install() {
|
| 52 |
drupal_install_schema('shoutbox');
|
| 53 |
}
|
| 54 |
|
| 55 |
/**
|
| 56 |
* Uninstall shoutbox.
|
| 57 |
*/
|
| 58 |
function shoutbox_uninstall() {
|
| 59 |
drupal_uninstall_schema('shoutbox');
|
| 60 |
|
| 61 |
// Delete variables.
|
| 62 |
variable_del('shoutbox_expire');
|
| 63 |
variable_del('shoutbox_showamount');
|
| 64 |
variable_del('shoutbox_ascending');
|
| 65 |
variable_del('shoutbox_defaultname');
|
| 66 |
variable_del('shoutbox_shownamefield');
|
| 67 |
variable_del('shoutbox_showurlfield');
|
| 68 |
variable_del('shoutbox_refresh');
|
| 69 |
variable_del('shoutbox_anonymous_timeout');
|
| 70 |
variable_del('shoutbox_registered_timeout');
|
| 71 |
}
|
| 72 |
|
| 73 |
|