| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_install().
|
| 6 |
*/
|
| 7 |
function game_character_install() {
|
| 8 |
drupal_install_schema('game_character');
|
| 9 |
}
|
| 10 |
|
| 11 |
/**
|
| 12 |
* Implementation of hook_uninstall().
|
| 13 |
*/
|
| 14 |
function game_character_uninstall() {
|
| 15 |
drupal_uninstall_schema('game_character');
|
| 16 |
|
| 17 |
// remove all variables that live in our namespace.
|
| 18 |
db_query("DELETE FROM {variable} WHERE name LIKE 'game_character_%'");
|
| 19 |
}
|
| 20 |
|
| 21 |
/**
|
| 22 |
* Implementation of hook_schema().
|
| 23 |
*/
|
| 24 |
function game_character_schema() {
|
| 25 |
$schema['game_characters'] = array(
|
| 26 |
'description' => t('Stores game character information for character nodes.'),
|
| 27 |
'fields' => array(
|
| 28 |
'nid' => array(
|
| 29 |
'description' => t("The {node}.nid of a specific character node."),
|
| 30 |
'not null' => TRUE,
|
| 31 |
'type' => 'int',
|
| 32 |
'unsigned' => TRUE,
|
| 33 |
),
|
| 34 |
'uid' => array(
|
| 35 |
'description' => t("The {user}.uid of the user last accessing the character node, generally the node's owner."),
|
| 36 |
'not null' => TRUE,
|
| 37 |
'type' => 'int',
|
| 38 |
'unsigned' => TRUE,
|
| 39 |
),
|
| 40 |
'access' => array(
|
| 41 |
'description' => t("The time this character node last became active by this user."),
|
| 42 |
'not null' => TRUE,
|
| 43 |
'type' => 'int',
|
| 44 |
'unsigned' => TRUE,
|
| 45 |
'default' => 0,
|
| 46 |
),
|
| 47 |
),
|
| 48 |
'indexes' => array('nid' => array('nid'), 'uid' => array('uid'), 'access' => array('access')),
|
| 49 |
);
|
| 50 |
$schema['game_character_claims'] = array(
|
| 51 |
'description' => t('Stores claim codes for claiming anonymous game character nodes.'),
|
| 52 |
'fields' => array(
|
| 53 |
'nid' => array(
|
| 54 |
'description' => t("The {node}.nid of a specific character node."),
|
| 55 |
'not null' => TRUE,
|
| 56 |
'type' => 'int',
|
| 57 |
'unsigned' => TRUE,
|
| 58 |
),
|
| 59 |
'claim' => array(
|
| 60 |
'type' => 'varchar',
|
| 61 |
'length' => 32,
|
| 62 |
'not null' => TRUE,
|
| 63 |
'default' => '',
|
| 64 |
'description' => t("Claim code (md5 hash)."),
|
| 65 |
),
|
| 66 |
),
|
| 67 |
'indexes' => array('nid' => array('nid')),
|
| 68 |
);
|
| 69 |
return $schema;
|
| 70 |
}
|