| pierre@0 | 1 <?php | 
| pierre@0 | 2 // $Id: ad_notify.install,v 1.1.2.2.2.6.2.3 2009/02/16 17:06:49 jeremy Exp $ | 
| pierre@0 | 3 | 
| pierre@0 | 4 /** | 
| pierre@0 | 5  * @file | 
| pierre@0 | 6  * Ad_notify module database schema. | 
| pierre@0 | 7  * | 
| pierre@0 | 8  * Copyright (c) 2005-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_notify_schema() { | 
| pierre@0 | 16   $schema['ad_notify'] = array( | 
| pierre@0 | 17     'description' => 'The ad_notify table stores notifications data such as recepient, message body, event, etc.', | 
| pierre@0 | 18     'fields' => array( | 
| pierre@0 | 19       'notid' => array( | 
| pierre@0 | 20         'type' => 'serial', | 
| pierre@0 | 21         'unsigned' => TRUE, | 
| pierre@0 | 22         'not null' => TRUE, | 
| pierre@0 | 23       ), | 
| pierre@0 | 24       'aid' => array( | 
| pierre@0 | 25         'type' => 'int', | 
| pierre@0 | 26         'unsigned' => TRUE, | 
| pierre@0 | 27         'not null' => TRUE, | 
| pierre@0 | 28         'default' => 0, | 
| pierre@0 | 29       ), | 
| pierre@0 | 30       'oid' => array( | 
| pierre@0 | 31         'type' => 'int', | 
| pierre@0 | 32         'unsigned' => TRUE, | 
| pierre@0 | 33         'not null' => TRUE, | 
| pierre@0 | 34         'default' => 0, | 
| pierre@0 | 35       ), | 
| pierre@0 | 36       'event' => array( | 
| pierre@0 | 37         'type' => 'varchar', | 
| pierre@0 | 38         'length' => '255', | 
| pierre@0 | 39         'not null' => TRUE, | 
| pierre@0 | 40         'default' => '' | 
| pierre@0 | 41       ), | 
| pierre@0 | 42       'delay' => array( | 
| pierre@0 | 43         'type' => 'int', | 
| pierre@0 | 44         'not null' => TRUE, | 
| pierre@0 | 45         'default' => 0, | 
| pierre@0 | 46       ), | 
| pierre@0 | 47       'queued' => array( | 
| pierre@0 | 48         'type' => 'int', | 
| pierre@0 | 49         'not null' => TRUE, | 
| pierre@0 | 50         'default' => 0, | 
| pierre@0 | 51       ), | 
| pierre@0 | 52       'sent' => array( | 
| pierre@0 | 53         'type' => 'int', | 
| pierre@0 | 54         'not null' => TRUE, | 
| pierre@0 | 55         'default' => 0, | 
| pierre@0 | 56       ), | 
| pierre@0 | 57       'counter' => array( | 
| pierre@0 | 58         'type' => 'int', | 
| pierre@0 | 59         'unsigned' => TRUE, | 
| pierre@0 | 60         'not null' => TRUE, | 
| pierre@0 | 61         'default' => 0, | 
| pierre@0 | 62       ), | 
| pierre@0 | 63       'locked' => array( | 
| pierre@0 | 64         'type' => 'int', | 
| pierre@0 | 65         'unsigned' => TRUE, | 
| pierre@0 | 66         'size' => 'tiny', | 
| pierre@0 | 67         'not null' => TRUE, | 
| pierre@0 | 68         'default' => 0, | 
| pierre@0 | 69       ), | 
| pierre@0 | 70       'expire' => array( | 
| pierre@0 | 71         'type' => 'int', | 
| pierre@0 | 72         'unsigned' => TRUE, | 
| pierre@0 | 73         'size' => 'tiny', | 
| pierre@0 | 74         'not null' => TRUE, | 
| pierre@0 | 75         'default' => 0, | 
| pierre@0 | 76       ), | 
| pierre@0 | 77       'status' => array( | 
| pierre@0 | 78         'type' => 'int', | 
| pierre@0 | 79         'unsigned' => TRUE, | 
| pierre@0 | 80         'size' => 'tiny', | 
| pierre@0 | 81         'not null' => TRUE, | 
| pierre@0 | 82         'default' => 0, | 
| pierre@0 | 83       ), | 
| pierre@0 | 84       'address' => array( | 
| pierre@0 | 85         'type' => 'varchar', | 
| pierre@0 | 86         'length' => '255', | 
| pierre@0 | 87         'not null' => TRUE, | 
| pierre@0 | 88         'default' => '', | 
| pierre@0 | 89       ), | 
| pierre@0 | 90       'subject' => array( | 
| pierre@0 | 91         'type' => 'varchar', | 
| pierre@0 | 92         'length' => '255', | 
| pierre@0 | 93         'not null' => TRUE, | 
| pierre@0 | 94         'default' => '', | 
| pierre@0 | 95       ), | 
| pierre@0 | 96       'body' => array( | 
| pierre@0 | 97         'type' => 'text', | 
| pierre@0 | 98         'not null' => FALSE, | 
| pierre@0 | 99       ), | 
| pierre@0 | 100     ), | 
| pierre@0 | 101     'primary key' => array('notid'), | 
| pierre@0 | 102     'unique keys' => array( | 
| pierre@0 | 103       'oid' => array('oid', 'event', 'delay'), | 
| pierre@0 | 104     ), | 
| pierre@0 | 105     'indexes' => array( | 
| pierre@0 | 106       'delay' => array('delay'), | 
| pierre@0 | 107       'event' => array('event'), | 
| pierre@0 | 108       'oid_2' => array('oid'), | 
| pierre@0 | 109       'queued' => array('queued'), | 
| pierre@0 | 110       'sent' => array('sent'), | 
| pierre@0 | 111       'status' => array('status'), | 
| pierre@0 | 112     ), | 
| pierre@0 | 113   ); | 
| pierre@0 | 114 | 
| pierre@0 | 115   return $schema; | 
| pierre@0 | 116 } | 
| pierre@0 | 117 | 
| pierre@0 | 118 /** | 
| pierre@0 | 119  * ad_notify module installation. | 
| pierre@0 | 120  */ | 
| pierre@0 | 121 function ad_notify_install() { | 
| pierre@0 | 122   drupal_install_schema('ad_notify'); | 
| pierre@0 | 123 } | 
| pierre@0 | 124 | 
| pierre@0 | 125 | 
| pierre@0 | 126 /** | 
| pierre@0 | 127  * Allow complete uninstallation of the ad_notify module. | 
| pierre@0 | 128  */ | 
| pierre@0 | 129 function ad_notify_uninstall() { | 
| pierre@0 | 130   // Remove tables. | 
| pierre@0 | 131   drupal_uninstall_schema('ad_notify'); | 
| pierre@0 | 132 } |