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

Diff of /contributions/modules/membership/membership.install

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

revision 1.1, Sun Feb 17 16:50:46 2008 UTC revision 1.2, Wed Feb 20 20:01:15 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id$  // $Id: membership.install,v 1.1 2008/02/17 16:50:46 boobaa Exp $
3    
4    /**
5     * Implementation of hook_schema().
6     */
7    function membership_schema() {
8      $schema['membership'] = array(
9        'fields' => array(
10          'mid' => array(
11            'type' => 'serial',
12            'not null' => TRUE,
13            'description' => t('Primary Key: Unique member ID.'),
14          ),
15          'uid' => array(
16            'type' => 'int',
17            'not null' => TRUE,
18            'default' => 0,
19            'description' => t('The {users}.uid who is a member of the given role.'),
20          ),
21          'oid' => array(
22            'type' => 'int',
23            'not null' => TRUE,
24            'default' => 0,
25            'description' => t('The {users}.uid who has last modified this membership.'),
26          ),
27          'lastmod' => array(
28            'type' => 'int',
29            'not null' => TRUE,
30            'default' => 0,
31            'description' => t('The time when the membership was last modified, as a Unix timestamp.'),
32          ),
33          'expires' => array(
34            'type' => 'int',
35            'not null' => TRUE,
36            'default' => 0,
37            'description' => t('The time when the membership will expire, as a Unix timestamp.'),
38          ),
39        ),
40        'indexes' => array(
41          'uid' => array('uid'),
42          'oid' => array('oid'), // This index is probably unused.
43          'lastmod' => array('lastmod'),
44          'expires' => array('expires'),
45        ),
46        'primary key' => array('mid'),
47      );
48      return $schema;
49    }
50    
51  /**  /**
52   * Implementation of hook_install().   * Implementation of hook_install().
53   */   */
54  function membership_install() {  function membership_install() {
55    switch ($GLOBALS['db_type']) {    // Create tables.
56    case 'mysql':    drupal_install_schema('membership');
   case 'mysqli':  
     db_query("CREATE TABLE {membership} (  
       mid int unsigned default '0',  
       uid int(10) UNSIGNED NOT NULL default '1',  
       oid int(10) UNSIGNED NOT NULL default '1',  
       lastmod int(11) NOT NULL default '0',  
       expires int(11) NOT NULL default '0',  
       PRIMARY KEY (mid)  
     ) /*!40100 DEFAULT CHARACTER SET UTF8 */");  
     break;  
   
   case 'pgsql':  
     // FIXME: to be implemented  
     break;  
   }  
57  }  }
58    
59  /**  /**
60   * Implementation of hook_uninstall().   * Implementation of hook_uninstall().
61   */   */
62  function membership_uninstall() {  function membership_uninstall() {
63    db_query('DROP TABLE {membership}');    // Remove tables.
64      drupal_uninstall_schema('membership');
65      // Remove variables.
66    variable_del('membership_role');    variable_del('membership_role');
67    variable_del('membership_manager');    variable_del('membership_manager');
68  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.2