function commerce_coupon_usage_schema in Commerce Coupon 7.2
Implements hook_schema().
File
- modules/
usage/ commerce_coupon_usage.install, line 18 - Installation procedure for Commerce Coupon Usage.
Code
function commerce_coupon_usage_schema() {
$schema['commerce_coupon_usage_transaction'] = array(
'description' => 'Table for keeping track of coupon usage',
'fields' => array(
'transaction_id' => array(
'description' => 'The primary identifier for this record.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'coupon_id' => array(
'description' => 'The primary identifier for a coupon.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'order_id' => array(
'description' => 'The primary identifier for an order.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'uid' => array(
'description' => 'The primary identifier for the user to whom this transaction is related.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'date' => array(
'description' => 'The Unix timestamp when the usage record was created.',
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'transaction_id',
),
'foreign keys' => array(
'uid' => array(
'table' => 'users',
'columns' => array(
'uid' => 'uid',
),
),
'coupon_id' => array(
'table' => 'commerce_coupon',
'columns' => array(
'coupon_id' => 'coupon_id',
),
),
'order_id' => array(
'table' => 'commerce_order',
'columns' => array(
'order_id' => 'order_id',
),
),
),
);
return $schema;
}