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

Diff of /contributions/modules/affiliates/affiliates.install

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

revision 1.1 by kbahey, Mon Nov 27 02:22:17 2006 UTC revision 1.2 by kbahey, Sat Jan 10 17:28:47 2009 UTC
# Line 0  Line 1 
1    <?php
2    // $Id: affiliates.install,v 1.1.4.2.2.5 2009/01/10 17:02:59 kbahey Exp $
3    
4    /**
5     * Implementation of hook_install().
6     */
7    function affiliates_install() {
8      drupal_install_schema('affiliates');
9    
10      db_query("INSERT INTO {affiliates_cats} VALUES (NULL, 'Email Signature', 'Y', 0);");
11      db_query("INSERT INTO {affiliates_cats} VALUES (NULL, 'Buttons', 'Y', 0);");
12      db_query("INSERT INTO {affiliates_cats} VALUES (NULL, 'Ad Banners', 'Y', 0);");
13    }
14    
15    /**
16     * Implementation of hook_uninstall().
17     */
18    function affiliates_uninstall() {
19      drupal_uninstall_schema('affiliates');
20      db_query("DELETE FROM {variable} WHERE name LIKE 'affiliate\_%'");
21    }
22    
23    
24    /**
25    * Implementation of hook_schema().
26    */
27    function affiliates_schema() {
28      $schema['affiliates'] = array(
29        'fields' => array(
30          'id'         => array('type' => 'serial',  'length' => '10', 'unsigned' => TRUE, 'not null' => TRUE ),
31          'user_id'    => array('type' => 'int',     'length' => '10', 'default' => NULL, 'unsigned' => TRUE ),
32          'cookie_id'  => array('type' => 'varchar', 'length' => '56', 'default' => NULL ),
33          'ip'         => array('type' => 'varchar', 'length' => '15', 'default' => NULL ),
34          'referer'    => array('type' => 'varchar', 'length' => '80', 'default' => NULL ),
35          'ad_id'      => array('type' => 'int',     'length' => '5',  'default' => NULL, 'unsigned' => TRUE ),
36          'click_time' => array('type' => 'int',     'length' => '11', 'default' => NULL ),
37        ),
38        'indexes' => array(
39          'affiliates_user_id'    => array('user_id'),
40          'affiliates_cookie_id'  => array('cookie_id'),
41          'affiliates_ip'         => array('ip'),
42          'affiliates_click_time' => array('click_time'),
43        ),
44        'primary key' => array('id'),
45      );
46      $schema['affiliates_ads'] = array(
47        'fields' => array(
48          'ad_id'    => array('type' => 'serial',  'length' => '5',   'unsigned' => TRUE, 'not null' => TRUE),
49          'label'    => array('type' => 'varchar', 'length' => '30',  'default' => NULL),
50          'points'   => array('type' => 'int',     'length' => '6',   'default' => NULL),
51          'anchor'   => array('type' => 'varchar', 'length' => '100', 'default' => NULL),
52          'type'     => array('type' => 'varchar', 'length' => '5',   'default' => NULL),
53          'cat_id'   => array('type' => 'int',     'length' => '3',   'default' => NULL, 'unsigned' => TRUE),
54          'order_by' => array('type' => 'int',     'length' => '5',   'default' => NULL),
55          'redirect' => array('type' => 'varchar', 'length' => '100', 'default' => NULL),
56          'status'   => array('type' => 'char',    'length' => '1',   'default' => 'a'),
57         ),
58        'indexes' => array(
59          'affiliates_ads_label'  => array('label'),
60          'affiliates_ads_type'   => array('type'),
61          'affiliates_ads_cat_id' => array('cat_id'),
62          'affiliates_ads_status' => array('status'),
63        ),
64        'primary key' => array('ad_id'),
65      );
66      $schema['affiliates_cats'] = array(
67        'fields' => array(
68          'cat_id'   => array('type' => 'serial',  'length' => '3',  'unsigned' => TRUE, 'not null' => TRUE ),
69          'cat_name' => array('type' => 'varchar', 'length' => '30', 'default' => NULL ),
70          'active'   => array('type' => 'char',    'length' => '1',  'default' => NULL ),
71          'weight'   => array('type' => 'int',     'length' => '3',  'default' => 0,     'not null' => TRUE ),
72        ),
73        'primary key' => array('cat_id'),
74      );
75      $schema['affiliates_summary'] = array(
76            'fields' => array(
77                    'user_id'                => array('type' => 'int', 'length' => '10' ),
78                    'total_points'           => array('type' => 'int', 'length' => '10' ),
79                    'period_points'          => array('type' => 'int', 'length' => '10' ),
80                    'previous_period_points' => array('type' => 'int', 'length' => '10' ),
81            ),
82            'primary key' => array('user_id'),
83      );
84    
85      return $schema;
86    }
87    
88    function affiliates_update_6001() {
89            $ret = array();
90      db_add_field($ret, 'affiliates_cats', 'weight', array('type' => 'int', 'length' => '3', 'not null' => TRUE, 'default' => 0));
91      return $ret;
92    }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.3