| 1 |
<?php
|
| 2 |
// $Id: fsgame.install,v 1.7 2008/08/13 11:46:00 aaron Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_install().
|
| 6 |
*/
|
| 7 |
function fsgame_install() {
|
| 8 |
drupal_install_schema('fsgame');
|
| 9 |
}
|
| 10 |
|
| 11 |
/**
|
| 12 |
* Implementation of hook_uninstall().
|
| 13 |
*/
|
| 14 |
function fsgame_uninstall() {
|
| 15 |
drupal_uninstall_schema('fsgame');
|
| 16 |
|
| 17 |
// remove all variables that live in our namespace.
|
| 18 |
db_query("DELETE FROM {variable} WHERE name LIKE 'fsgame_%'");
|
| 19 |
}
|
| 20 |
|
| 21 |
/**
|
| 22 |
* Implementation of hook_schema().
|
| 23 |
*/
|
| 24 |
function fsgame_schema() {
|
| 25 |
$schema['fsgame_character'] = array(
|
| 26 |
'description' => t('Stores standard information about a 5 Second Game character.'),
|
| 27 |
'fields' => array(
|
| 28 |
'nid' => array(
|
| 29 |
'description' => t("The {node}.nid of this character's node."),
|
| 30 |
'not null' => TRUE,
|
| 31 |
'type' => 'int',
|
| 32 |
'unsigned' => TRUE,
|
| 33 |
),
|
| 34 |
'rock' => array(
|
| 35 |
'default' => 1,
|
| 36 |
'description' => t("The current value of the character's rock attribute."),
|
| 37 |
'not null' => TRUE,
|
| 38 |
'type' => 'int',
|
| 39 |
),
|
| 40 |
'paper' => array(
|
| 41 |
'default' => 1,
|
| 42 |
'description' => t("The current value of the character's paper attribute."),
|
| 43 |
'not null' => TRUE,
|
| 44 |
'type' => 'int',
|
| 45 |
),
|
| 46 |
'scissors' => array(
|
| 47 |
'default' => 1,
|
| 48 |
'description' => t("The current value of the character's scissor attribute."),
|
| 49 |
'not null' => TRUE,
|
| 50 |
'type' => 'int',
|
| 51 |
),
|
| 52 |
'class' => array(
|
| 53 |
'default' => '',
|
| 54 |
'description' => t('The chosen class of this character.'),
|
| 55 |
'length' => 255,
|
| 56 |
'not null' => TRUE,
|
| 57 |
'type' => 'varchar',
|
| 58 |
),
|
| 59 |
'level' => array(
|
| 60 |
'default' => 1,
|
| 61 |
'description' => t("The current level the character has achieved in their class."),
|
| 62 |
'not null' => TRUE,
|
| 63 |
'type' => 'int',
|
| 64 |
),
|
| 65 |
'latest_opponent' => array(
|
| 66 |
'description' => t("The {node}.nid of this character's most recently fought opponent's node."),
|
| 67 |
'not null' => TRUE,
|
| 68 |
'type' => 'int',
|
| 69 |
'unsigned' => TRUE,
|
| 70 |
),
|
| 71 |
),
|
| 72 |
'primary key' => array('nid'),
|
| 73 |
);
|
| 74 |
$schema['fsgame_user'] = array(
|
| 75 |
'description' => t('Stores fsgame information for users.'),
|
| 76 |
'fields' => array(
|
| 77 |
'uid' => array(
|
| 78 |
'description' => t("The {user}.uid of a specific user."),
|
| 79 |
'not null' => TRUE,
|
| 80 |
'type' => 'int',
|
| 81 |
'unsigned' => TRUE,
|
| 82 |
),
|
| 83 |
'fsgame_latest_character' => array(
|
| 84 |
'description' => t("The {node}.nid of this user's most recently accessed character's node."),
|
| 85 |
'not null' => TRUE,
|
| 86 |
'type' => 'int',
|
| 87 |
'unsigned' => TRUE,
|
| 88 |
),
|
| 89 |
),
|
| 90 |
'primary key' => array('uid'),
|
| 91 |
);
|
| 92 |
$schema['fsgame_character_skills'] = array(
|
| 93 |
'description' => t('Stores fsgame information for character skills.'),
|
| 94 |
'fields' => array(
|
| 95 |
'nid' => array(
|
| 96 |
'description' => t("The {node}.nid of a character's node."),
|
| 97 |
'not null' => TRUE,
|
| 98 |
'type' => 'int',
|
| 99 |
'unsigned' => TRUE,
|
| 100 |
),
|
| 101 |
'skill' => array(
|
| 102 |
'description' => t("The name of the skill being stored."),
|
| 103 |
'not null' => TRUE,
|
| 104 |
'type' => 'varchar',
|
| 105 |
'default' => '',
|
| 106 |
'length' => 255,
|
| 107 |
),
|
| 108 |
'level' => array(
|
| 109 |
'default' => 1,
|
| 110 |
'description' => t("The current level the character has achieved in this skill."),
|
| 111 |
'not null' => TRUE,
|
| 112 |
'type' => 'int',
|
| 113 |
),
|
| 114 |
),
|
| 115 |
'indexes' => array('nid' => array('nid'), 'skill' => array('skill')),
|
| 116 |
);
|
| 117 |
return $schema;
|
| 118 |
}
|