function payment_schema in Payment 7
Same name and namespace in other branches
- 8.2 payment.install \payment_schema()
Implements hook_schema().
File
- ./
payment.install, line 11 - Installation and uninstallation functions.
Code
function payment_schema() {
$schema['payment_line_item'] = array(
'fields' => array(
'amount' => array(
'type' => 'float',
'size' => 'big',
'not null' => TRUE,
),
'amount_total' => array(
'type' => 'float',
'size' => 'big',
'not null' => TRUE,
),
'description' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'description_arguments' => array(
'type' => 'blob',
'size' => 'big',
'serialize' => TRUE,
),
'name' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'pid' => array(
'description' => 'The {payment}.pid this line item belongs to.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'quantity' => array(
'type' => 'float',
'size' => 'big',
'default' => 1.0,
'not null' => TRUE,
),
'tax_rate' => array(
'type' => 'float',
'size' => 'big',
'default' => 0.0,
'not null' => TRUE,
),
),
'primary key' => array(
'name',
'pid',
),
'foreign keys' => array(
'pid' => array(
'table' => 'payment',
'columns' => array(
'pid' => 'pid',
),
),
),
'indexes' => array(
'pid' => array(
'pid',
),
),
);
$schema['payment'] = array(
'fields' => array(
'context' => array(
'type' => 'varchar',
'length' => 255,
),
'context_data' => array(
'type' => 'blob',
'size' => 'big',
'serialize' => TRUE,
),
'currency_code' => array(
'type' => 'varchar',
'length' => 3,
'default' => 'XXX',
'not null' => TRUE,
),
'description' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'description_arguments' => array(
'type' => 'blob',
'size' => 'big',
'serialize' => TRUE,
'not null' => TRUE,
),
'finish_callback' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'pid' => array(
'type' => 'serial',
'not null' => TRUE,
),
'pmid' => array(
'type' => 'int',
'unsigned' => TRUE,
'default' => 0,
'not null' => TRUE,
),
'psiid_first' => array(
'description' => "The {payment_status_item}.psiid of this payment's first status item.",
'type' => 'int',
'unsigned' => TRUE,
'default' => 0,
'not null' => TRUE,
),
'psiid_last' => array(
'description' => "The {payment_status_item}.psiid of this payment's most recent status item.",
'type' => 'int',
'unsigned' => TRUE,
'default' => 0,
'not null' => TRUE,
),
'uid' => array(
'description' => 'The {users}.uid this payment belongs to.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'foreign keys' => array(
'pmid' => array(
'table' => 'payment_method',
'columns' => array(
'pmid' => 'pmid',
),
),
'psiid_last' => array(
'table' => 'payment_status_item',
'columns' => array(
'psiid_last' => 'psiid',
),
),
'psiid_first' => array(
'table' => 'payment_status_item',
'columns' => array(
'psiid_first' => 'psiid',
),
),
'uid' => array(
'table' => 'users',
'columns' => array(
'uid' => 'uid',
),
),
),
'indexes' => array(
'pid' => array(
'pid',
),
),
'primary key' => array(
'pid',
),
);
$schema['payment_status_item'] = array(
'fields' => array(
'status' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'created' => array(
'type' => 'int',
'not null' => TRUE,
),
'pid' => array(
'description' => 'The payment ID.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'psiid' => array(
'type' => 'serial',
'not null' => TRUE,
),
),
'foreign keys' => array(
'pid' => array(
'table' => 'payment',
'columns' => array(
'pid' => 'pid',
),
),
),
'indexes' => array(
'pid' => array(
'pid',
),
),
'primary key' => array(
'psiid',
),
);
$schema['payment_method'] = array(
'fields' => array(
'controller_class_name' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'enabled' => array(
'type' => 'int',
'size' => 'tiny',
'default' => 0,
'not null' => TRUE,
),
'module' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'name' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'pmid' => array(
'type' => 'serial',
'not null' => TRUE,
),
'status' => array(
'type' => 'int',
'size' => 'tiny',
'default' => ENTITY_CUSTOM,
'not null' => TRUE,
),
'title_generic' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'title_specific' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'uid' => array(
'description' => 'The {users}.uid this {payment_method} belongs to.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'controller_data' => array(
'description' => 'Serialized controller data',
'type' => 'text',
'serialize' => TRUE,
'not null' => TRUE,
),
),
'foreign keys' => array(
'uid' => array(
'table' => 'users',
'columns' => array(
'uid' => 'uid',
),
),
),
'primary key' => array(
'pmid',
),
'unique keys' => array(
'pmid' => array(
'pmid',
),
),
);
return $schema;
}