[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/donation/ -> donation.install (source)

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


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7