| 1 |
<?php
|
| 2 |
// $Id: bookmaker.install,v 1.9 2008/10/28 16:23:25 toddy Exp $
|
| 3 |
/*
|
| 4 |
* Copyright (C) 2006-2008 Tobias Quathamer <t.quathamer@gmx.net>
|
| 5 |
*
|
| 6 |
* This file is part of Bookmaker.
|
| 7 |
*
|
| 8 |
* Bookmaker is free software; you can redistribute it and/or modify
|
| 9 |
* it under the terms of the GNU General Public License as published by
|
| 10 |
* the Free Software Foundation; either version 2 of the License, or
|
| 11 |
* (at your option) any later version.
|
| 12 |
*
|
| 13 |
* Bookmaker is distributed in the hope that it will be useful,
|
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 16 |
* GNU General Public License for more details.
|
| 17 |
*
|
| 18 |
* You should have received a copy of the GNU General Public License
|
| 19 |
* along with Bookmaker; if not, write to the Free Software
|
| 20 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
| 21 |
*/
|
| 22 |
|
| 23 |
/**
|
| 24 |
* @file
|
| 25 |
* Database schema for the bookmaker module
|
| 26 |
*/
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
/**
|
| 31 |
* Implementation of hook_install().
|
| 32 |
*/
|
| 33 |
function bookmaker_install() {
|
| 34 |
drupal_install_schema('bookmaker');
|
| 35 |
}
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
/**
|
| 40 |
* Implementation of hook_uninstall().
|
| 41 |
*/
|
| 42 |
function bookmaker_uninstall() {
|
| 43 |
drupal_uninstall_schema('bookmaker');
|
| 44 |
variable_del('bookmaker_number_of_shortly_closing_bet_offers');
|
| 45 |
variable_del('bookmaker_number_of_recently_added_bet_offers');
|
| 46 |
}
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
/**
|
| 51 |
* Implementation of hook_schema().
|
| 52 |
*/
|
| 53 |
function bookmaker_schema() {
|
| 54 |
$schema['bookmaker'] = array(
|
| 55 |
'description' => 'Holds additional information for the custom node type',
|
| 56 |
'fields' => array(
|
| 57 |
'nid' => array(
|
| 58 |
'description' => 'Node id',
|
| 59 |
'type' => 'int', 'not null' => TRUE, 'default' => 0
|
| 60 |
),
|
| 61 |
'vid' => array(
|
| 62 |
'description' => 'Revision id',
|
| 63 |
'type' => 'int', 'not null' => TRUE, 'default' => 0
|
| 64 |
),
|
| 65 |
'closes_on' => array(
|
| 66 |
'description' => 'Timestamp of the latest possible bet placement',
|
| 67 |
'type' => 'int', 'not null' => TRUE, 'default' => 0
|
| 68 |
),
|
| 69 |
'outcome' => array(
|
| 70 |
'description' => 'Outcome of the bet',
|
| 71 |
'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''
|
| 72 |
),
|
| 73 |
'points' => array(
|
| 74 |
'description' => 'Points which a user receives for successful bets',
|
| 75 |
'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''
|
| 76 |
),
|
| 77 |
),
|
| 78 |
'primary key' => array(
|
| 79 |
'nid', 'vid'
|
| 80 |
),
|
| 81 |
);
|
| 82 |
|
| 83 |
$schema['bookmaker_bets'] = array(
|
| 84 |
'description' => 'Holds information about the placed bets of users',
|
| 85 |
'fields' => array(
|
| 86 |
'nid' => array(
|
| 87 |
'description' => 'Node id',
|
| 88 |
'type' => 'int', 'not null' => TRUE, 'default' => 0
|
| 89 |
),
|
| 90 |
'uid' => array(
|
| 91 |
'description' => 'User id',
|
| 92 |
'type' => 'int', 'not null' => TRUE, 'default' => 0
|
| 93 |
),
|
| 94 |
'bet' => array(
|
| 95 |
'description' => 'Actual bet text',
|
| 96 |
'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''
|
| 97 |
),
|
| 98 |
'placed_on' => array(
|
| 99 |
'description' => 'Timestamp of the bet placement',
|
| 100 |
'type' => 'int', 'not null' => TRUE, 'default' => 0
|
| 101 |
),
|
| 102 |
'user_points' => array(
|
| 103 |
'description' => 'Points the user won with this bet',
|
| 104 |
'type' => 'int', 'not null' => TRUE, 'default' => 0
|
| 105 |
),
|
| 106 |
),
|
| 107 |
'primary key' => array(
|
| 108 |
'nid', 'uid'
|
| 109 |
),
|
| 110 |
);
|
| 111 |
|
| 112 |
return $schema;
|
| 113 |
}
|