/[drupal]/contributions/modules/referral/referral.install
ViewVC logotype

Contents of /contributions/modules/referral/referral.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.6 - (show annotations) (download) (as text)
Mon Nov 10 17:39:32 2008 UTC (12 months, 2 weeks ago) by kbahey
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +65 -19 lines
File MIME type: text/x-php
#331366 by stokito, add hook_schema, and use it in install/uninstall.
1 <?php
2 // $Id: referral.install,v 1.5.2.1 2008/11/10 17:38:50 kbahey Exp $
3
4 /**
5 * Implementation of hook_schema().
6 */
7 function referral_schema() {
8 $schema['referral'] = array(
9 'fields' => array(
10 'uid' => array(
11 'description' => t('The {users}.uid of the user who was invited.'),
12 'type' => 'int',
13 'unsigned' => TRUE,
14 'not null' => TRUE,
15 'default' => 0),
16 'referral_uid' => array(
17 'description' => t('The {users}.uid of the referer.'),
18 'type' => 'int',
19 'unsigned' => TRUE,
20 'not null' => TRUE,
21 'default' => 0),
22 'created' => array(
23 'description' => t('UNIX timestamp for when the user was registered.'),
24 'type' => 'int',
25 'unsigned' => TRUE,
26 'not null' => TRUE,
27 'default' => 0),
28 'flag' => array(
29 'type' => 'int',
30 'not null' => TRUE,
31 'default' => 0),
32 'flag_timestamp' => array(
33 'type' => 'int',
34 'unsigned' => TRUE,
35 'not null' => TRUE,
36 'default' => 0),
37 'host' => array(
38 'type' => 'varchar',
39 'length' => 255,
40 'not null' => TRUE,
41 'default' => '',
42 'description' => t('Network address.')),
43 'http_referer' => array(
44 'type' => 'varchar',
45 'length' => 255,
46 'not null' => TRUE,
47 'default' => '',
48 'description' => t('URL of referer site.'),),
49 ),
50 'primary key' => array('uid'),
51 'indexes' => array('referral_uid' => array('referral_uid')),
52 );
53 return $schema;
54 }
55
56 /**
57 * Implementation of hook_install().
58 */
59 function referral_install() {
60 // Create tables.
61 $result = drupal_install_schema('referral');
62 }
63
64 /**
65 * Implementation of hook_uninstall().
66 */
67 function referral_uninstall() {
68 // Remove variables.
69 db_query("DELETE FROM {variable} WHERE name LIKE 'referral_%%'");
70 // Remove tables.
71 drupal_uninstall_schema('referral');
72 }

  ViewVC Help
Powered by ViewVC 1.1.2