You are here

contribute.install in Contribute 6

Same filename and directory in other branches
  1. 8 contribute.install

File

contribute.install
View source
<?php

/**
 *
 * Implementation of hook_install().
 */
function contribute_install() {

  // Use scheme API to create database table.
  drupal_install_schema('contribute');
}

/**
 * Implementation of hook_uninstall().
 */
function contribute_uninstall() {

  // Use schema API to delete database table.
  drupal_uninstall_schema('contribute');
}

/**
 * Implementation of hook_schema().
 */
function contribute_schema() {
  $schema['contribute_contributions'] = array(
    'description' => t('Stores contributions users make to nodes'),
    'fields' => array(
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('The {user}.uid to who made the contribution'),
      ),
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('The {node}.nid to which the contribution applies'),
      ),
      'amount' => array(
        'type' => 'float',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('The amount of the contribution'),
      ),
      'created' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('A Unix timestamp indicating when the contribution was made'),
      ),
      'id' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => t('An auto-incremented ID of the contribution'),
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  $schema['contribute_contribution_recipients'] = array(
    'description' => t('Stores information about budget and total contributed or pledged'),
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('The {node}.nid to which the numbers apply'),
      ),
      'total' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('The total contributed'),
      ),
      'budget' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'default' => 0,
        'description' => t('The total budget or amount needed'),
      ),
    ),
    'primary key' => array(
      'nid',
    ),
  );
  $schema['contribute_account_balances'] = array(
    'description' => t('Stores user account balances'),
    'fields' => array(
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('The {user}.uid'),
      ),
      'balance' => array(
        'type' => 'float',
        'unsigned' => FALSE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('The balance'),
      ),
    ),
    'primary key' => array(
      'uid',
    ),
  );
  return $schema;
}

Functions

Namesort descending Description
contribute_install Implementation of hook_install().
contribute_schema Implementation of hook_schema().
contribute_uninstall Implementation of hook_uninstall().