| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @file 5 * Install script for a simple donation module. 6 */ 7 8 /** 9 * Implementation of hook_install(). 10 */ 11 12 function donation_install() { 13 drupal_install_schema('donation'); 14 } 15 16 /** 17 * Implementation of hook_schema(). 18 */ 19 function donation_schema() { 20 $schema['donations'] = array( 21 'fields' => array( 22 'did' => array('type' => 'serial', 'not null' => TRUE, 'disp-width' => '10'), 23 'status' => array('type' => 'int', 'default' => 1, 'not null' => TRUE, 'disp-width' => '2'), 24 'name' => array('type' => 'varchar', 'length' => '128', 'not null' => FALSE), 25 'mail' => array('type' => 'varchar', 'length' => '128', 'not null' => FALSE), 26 'timestamp' => array('type' => 'int', 'default' => 0, 'not null' => TRUE, 'disp-width' => '11'), 27 'amount' => array('type' => 'float', 'not null' => FALSE), 28 'currency' => array('type' => 'varchar', 'length' => '5', 'not null' => FALSE, 'default' => 'USD'), 29 'uid' => array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11'), 30 'donor_name' => array('type' => 'varchar', 'length' => '255', 'not null' => FALSE), 31 'donor_url' => array('type' => 'varchar', 'length' => '255', 'not null' => FALSE), 32 'donor_memo' => array('type' => 'varchar', 'length' => '255', 'not null' => FALSE), 33 'paypal_txn_id' => array('type' => 'varchar', 'length' => '255', 'not null' => FALSE), 34 'donor_comment' => array('type' => 'varchar', 'length' => '255', 'not null' => FALSE), 35 'nid' => array('type' => 'int'), 36 'fee' => array('type' => 'float', 'not null' => FALSE), 37 ), 38 'primary key' => array('did'), 39 'indexes' => array( 40 'donation_mail_idx' => array('mail'), 41 'donation_timestamp_idx' => array('timestamp'), 42 'donation_uid_idx' => array('uid')), 43 ); 44 return $schema; 45 } 46 47 /** 48 * Implementation of hook_uninstall(). 49 */ 50 function donation_uninstall() { 51 drupal_uninstall_schema('donation'); 52 } 53 54 /** 55 * Implementation of hook_update(). 56 */ 57 function donation_update_1() { 58 $ret = array(); 59 db_add_field($ret, 'donations', 'nid', array('type' => 'int')); 60 db_add_field($ret, 'donations', 'fee', array('type' => 'float', 'not null' => FALSE)); 61 return $ret; 62 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |