| 
pierre@0
 | 
     1 <?php | 
| 
pierre@1
 | 
     2 // $Id: ad_owners.install,v 1.1.2.2.2.1 2009/02/23 22:39:04 jeremy Exp $ | 
| 
pierre@0
 | 
     3  | 
| 
pierre@0
 | 
     4 /** | 
| 
pierre@0
 | 
     5  * @file | 
| 
pierre@0
 | 
     6  * Ad_owners module database schema. | 
| 
pierre@0
 | 
     7  * | 
| 
pierre@0
 | 
     8  * Copyright (c) 2009. | 
| 
pierre@0
 | 
     9  *   Jeremy Andrews <jeremy@tag1consulting.com>. | 
| 
pierre@0
 | 
    10  */ | 
| 
pierre@0
 | 
    11  | 
| 
pierre@0
 | 
    12 /** | 
| 
pierre@0
 | 
    13  * Implementation of hook_schema(). | 
| 
pierre@0
 | 
    14  */ | 
| 
pierre@0
 | 
    15 function ad_owners_schema() { | 
| 
pierre@0
 | 
    16   $schema['ad_owners'] = array( | 
| 
pierre@0
 | 
    17     'description' => 'Stores information about ad owners. Every ad can have one or more owners.', | 
| 
pierre@0
 | 
    18     'fields' => array( | 
| 
pierre@0
 | 
    19       'oid' => array( | 
| 
pierre@0
 | 
    20         'type' => 'serial', | 
| 
pierre@0
 | 
    21         'not null' => TRUE, | 
| 
pierre@0
 | 
    22         'unsigned' => TRUE, | 
| 
pierre@0
 | 
    23         'description' => 'Unique owner pair ID.', | 
| 
pierre@0
 | 
    24       ), | 
| 
pierre@0
 | 
    25       'aid' => array( | 
| 
pierre@0
 | 
    26         'type' => 'int', | 
| 
pierre@0
 | 
    27         'not null' => TRUE, | 
| 
pierre@0
 | 
    28         'unsigned' => TRUE, | 
| 
pierre@0
 | 
    29         'default' => 0, | 
| 
pierre@0
 | 
    30         'description' => 'Ad id.', | 
| 
pierre@0
 | 
    31       ), | 
| 
pierre@0
 | 
    32       'uid' => array( | 
| 
pierre@0
 | 
    33         'type' => 'int', | 
| 
pierre@0
 | 
    34         'not null' => TRUE, | 
| 
pierre@0
 | 
    35         'unsigned' => TRUE, | 
| 
pierre@0
 | 
    36         'default' => 0, | 
| 
pierre@0
 | 
    37         'description' => 'The {users}.uid that owns ad.', | 
| 
pierre@0
 | 
    38       ), | 
| 
pierre@0
 | 
    39     ), | 
| 
pierre@0
 | 
    40     'primary key' => array('oid'), | 
| 
pierre@0
 | 
    41     'indexes' => array( | 
| 
pierre@0
 | 
    42       'aid' => array('aid'), | 
| 
pierre@0
 | 
    43       'uid' => array('uid'), | 
| 
pierre@0
 | 
    44     ), | 
| 
pierre@0
 | 
    45   ); | 
| 
pierre@0
 | 
    46  | 
| 
pierre@0
 | 
    47  /** | 
| 
pierre@0
 | 
    48   * Permissions can be granted to each owner of each ad.  The same owner | 
| 
pierre@0
 | 
    49   * can own multiple ads, and can have different permissions for each ad. | 
| 
pierre@0
 | 
    50   */ | 
| 
pierre@0
 | 
    51   $schema['ad_permissions'] = array( | 
| 
pierre@0
 | 
    52     'description' => 'Permissions can be granted to each owner of each ad. The same owner can own multiple ads, and can have different permissions for each ad.', | 
| 
pierre@0
 | 
    53     'fields' => array( | 
| 
pierre@0
 | 
    54       'oid' => array( | 
| 
pierre@0
 | 
    55         'type' => 'int', | 
| 
pierre@0
 | 
    56         'not null' => TRUE, | 
| 
pierre@0
 | 
    57         'unsigned' => TRUE, | 
| 
pierre@0
 | 
    58         'default' => 0, | 
| 
pierre@0
 | 
    59         'description' => 'Owner pair ID.', | 
| 
pierre@0
 | 
    60       ), | 
| 
pierre@0
 | 
    61       'permissions' => array( | 
| 
pierre@0
 | 
    62         'type' => 'text', | 
| 
pierre@0
 | 
    63         'not null' => FALSE, | 
| 
pierre@0
 | 
    64         'size' => 'big', | 
| 
pierre@0
 | 
    65         'description' => 'Ad permission info.', | 
| 
pierre@0
 | 
    66       ), | 
| 
pierre@0
 | 
    67     ), | 
| 
pierre@0
 | 
    68     'primary key' => array('oid'), | 
| 
pierre@0
 | 
    69   ); | 
| 
pierre@0
 | 
    70  | 
| 
pierre@1
 | 
    71  /** | 
| 
pierre@1
 | 
    72   * The ad_hosts table is used to configure users that can display ads | 
| 
pierre@1
 | 
    73   * remotely. | 
| 
pierre@1
 | 
    74   */ | 
| 
pierre@1
 | 
    75   $schema['ad_hosts'] = array( | 
| 
pierre@1
 | 
    76     'description' => 'The ad_hosts table is used to configure users that can display ads remotely. ', | 
| 
pierre@1
 | 
    77     'fields' => array( | 
| 
pierre@1
 | 
    78       'uid' => array( | 
| 
pierre@1
 | 
    79         'type' => 'int', | 
| 
pierre@1
 | 
    80         'not null' => TRUE, | 
| 
pierre@1
 | 
    81         'unsigned' => TRUE, | 
| 
pierre@1
 | 
    82         'default' => 0, | 
| 
pierre@1
 | 
    83         'description' => '', | 
| 
pierre@1
 | 
    84       ), | 
| 
pierre@1
 | 
    85       'hostid' => array( | 
| 
pierre@1
 | 
    86         'type' => 'varchar', | 
| 
pierre@1
 | 
    87         'length' => 32, | 
| 
pierre@1
 | 
    88         'not null' => TRUE, | 
| 
pierre@1
 | 
    89         'default' => '', | 
| 
pierre@1
 | 
    90         'description' => 'Host from which acion was made.', | 
| 
pierre@1
 | 
    91       ), | 
| 
pierre@1
 | 
    92       'status' => array( | 
| 
pierre@1
 | 
    93         'type' => 'int', | 
| 
pierre@1
 | 
    94         'size' => 'tiny', | 
| 
pierre@1
 | 
    95         'not null' => TRUE, | 
| 
pierre@1
 | 
    96         'unsigned' => TRUE, | 
| 
pierre@1
 | 
    97         'default' => 0, | 
| 
pierre@1
 | 
    98         'description' => '', | 
| 
pierre@1
 | 
    99       ), | 
| 
pierre@1
 | 
   100       'description' => array( | 
| 
pierre@1
 | 
   101         'type' => 'text', | 
| 
pierre@1
 | 
   102         'not null' => FALSE, | 
| 
pierre@1
 | 
   103         'description' => 'Host from which acion was made.', | 
| 
pierre@1
 | 
   104       ), | 
| 
pierre@1
 | 
   105     ), | 
| 
pierre@1
 | 
   106     'primary key' => array('uid'), | 
| 
pierre@1
 | 
   107     'indexes' => array( | 
| 
pierre@1
 | 
   108       'status' => array('status'), | 
| 
pierre@1
 | 
   109       'hostid' => array('hostid'), | 
| 
pierre@1
 | 
   110     ), | 
| 
pierre@1
 | 
   111   ); | 
| 
pierre@1
 | 
   112  | 
| 
pierre@0
 | 
   113   return $schema; | 
| 
pierre@0
 | 
   114 } | 
| 
pierre@0
 | 
   115  | 
| 
pierre@0
 | 
   116 /** | 
| 
pierre@0
 | 
   117  * ad_external module installation. | 
| 
pierre@0
 | 
   118  */ | 
| 
pierre@0
 | 
   119 function ad_owners_install() { | 
| 
pierre@0
 | 
   120   drupal_install_schema('ad_owners'); | 
| 
pierre@0
 | 
   121 } | 
| 
pierre@0
 | 
   122  | 
| 
pierre@0
 | 
   123 /** | 
| 
pierre@0
 | 
   124  * Allow complete uninstallation of the ad_external module. | 
| 
pierre@0
 | 
   125  */ | 
| 
pierre@0
 | 
   126 function ad_owners() { | 
| 
pierre@0
 | 
   127   drupal_uninstall_schema('ad_owners'); | 
| 
pierre@0
 | 
   128 } |