| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* The installation file for the Game Clock module.
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Implementation of hook_install().
|
| 11 |
*/
|
| 12 |
function game_queue_install() {
|
| 13 |
$success = drupal_install_schema('game_queue');
|
| 14 |
|
| 15 |
if ($success) {
|
| 16 |
drupal_set_message(st('Game Queue module installed tables successfully.'));
|
| 17 |
}
|
| 18 |
else {
|
| 19 |
drupal_set_message(st('The installation of Game Queue module failed.'), 'error');
|
| 20 |
}
|
| 21 |
}
|
| 22 |
|
| 23 |
/**
|
| 24 |
* Implementation of hook_uninstall().
|
| 25 |
*/
|
| 26 |
function game_queue_uninstall() {
|
| 27 |
drupal_uninstall_schema('game_queue');
|
| 28 |
$result = db_query("SELECT name FROM {variable} WHERE name LIKE 'game_queue_%'");
|
| 29 |
while ($row = db_fetch_object($result)) {
|
| 30 |
variable_del($row->name);
|
| 31 |
}
|
| 32 |
|
| 33 |
drupal_set_message(t('Game Queue has been uninstalled.'));
|
| 34 |
}
|
| 35 |
|
| 36 |
/**
|
| 37 |
* Implementation of hook_schema().
|
| 38 |
*/
|
| 39 |
function game_queue_schema() {
|
| 40 |
$schema = array();
|
| 41 |
|
| 42 |
$schema['game_queue'] = array(
|
| 43 |
'fields' => array(
|
| 44 |
'aid' => array(
|
| 45 |
'type' => 'serial',
|
| 46 |
'size' => 'small',
|
| 47 |
'unsigned' => TRUE,
|
| 48 |
'not null' => TRUE,
|
| 49 |
),
|
| 50 |
'nid' => array(
|
| 51 |
'description' => t("The {node}.nid of a specific character node."),
|
| 52 |
'not null' => TRUE,
|
| 53 |
'type' => 'int',
|
| 54 |
'unsigned' => TRUE,
|
| 55 |
),
|
| 56 |
'cid' => array(
|
| 57 |
'description' => t("The {game_clocks}.cid of a game clock."),
|
| 58 |
'not null' => TRUE,
|
| 59 |
'type' => 'int',
|
| 60 |
'unsigned' => TRUE,
|
| 61 |
),
|
| 62 |
'action' => array(
|
| 63 |
'type' => 'varchar',
|
| 64 |
'length' => '32',
|
| 65 |
'not null' => FALSE,
|
| 66 |
'default' => '',
|
| 67 |
),
|
| 68 |
'options' => array(
|
| 69 |
'type' => 'text',
|
| 70 |
'not null' => FALSE,
|
| 71 |
'size' => 'big',
|
| 72 |
'description' => t('A serialized array of option value pairs to be passed as the action argument.'),
|
| 73 |
),
|
| 74 |
'timestamp' => array(
|
| 75 |
'type' => 'int',
|
| 76 |
'unsigned' => TRUE,
|
| 77 |
'not null' => TRUE,
|
| 78 |
'default' => 0,
|
| 79 |
'disp-size' => 11,
|
| 80 |
),
|
| 81 |
'turn' => array(
|
| 82 |
'type' => 'int',
|
| 83 |
'unsigned' => TRUE,
|
| 84 |
'not null' => TRUE,
|
| 85 |
'default' => 0,
|
| 86 |
'disp-size' => 11,
|
| 87 |
),
|
| 88 |
'ap' => array(
|
| 89 |
'type' => 'int',
|
| 90 |
'not null' => TRUE,
|
| 91 |
'default' => 0,
|
| 92 |
),
|
| 93 |
),
|
| 94 |
'primary key' => array('aid'),
|
| 95 |
'indexes' => array('nid' => array('nid'), 'cid' => array('cid'), 'turn' => array('turn'), 'timestamp' => array('timestamp')),
|
| 96 |
);
|
| 97 |
|
| 98 |
return $schema;
|
| 99 |
}
|