| pierre@0 | 1 <?php | 
| pierre@0 | 2 // $Id: ad_owners.install,v 1.1.2.2 2009/02/16 17:06:49 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@0 | 71   return $schema; | 
| pierre@0 | 72 } | 
| pierre@0 | 73 | 
| pierre@0 | 74 /** | 
| pierre@0 | 75  * ad_external module installation. | 
| pierre@0 | 76  */ | 
| pierre@0 | 77 function ad_owners_install() { | 
| pierre@0 | 78   drupal_install_schema('ad_owners'); | 
| pierre@0 | 79 } | 
| pierre@0 | 80 | 
| pierre@0 | 81 /** | 
| pierre@0 | 82  * Allow complete uninstallation of the ad_external module. | 
| pierre@0 | 83  */ | 
| pierre@0 | 84 function ad_owners() { | 
| pierre@0 | 85   drupal_uninstall_schema('ad_owners'); | 
| pierre@0 | 86 } |