View source
<?php
function contribute_install() {
drupal_install_schema('contribute');
}
function contribute_uninstall() {
drupal_uninstall_schema('contribute');
}
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;
}