function commerce_coupon_schema in Commerce Coupon 7.2
Same name and namespace in other branches
- 7 commerce_coupon.install \commerce_coupon_schema()
Implements hook_schema().
File
- ./
commerce_coupon.install, line 143 - Installation hooks and procedures for Commerce Coupon.
Code
function commerce_coupon_schema() {
$schema['commerce_coupon'] = array(
'description' => 'The base table for coupons.',
'fields' => array(
'coupon_id' => array(
'description' => 'The primary identifier for the coupon.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'uid' => array(
'description' => 'An identifier for the user who owns this coupon',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'type' => array(
'description' => 'The type of this coupon.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'code' => array(
'description' => 'The code of this coupon.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'bulk' => array(
'description' => 'Whether or not this coupon code was generated in bulk.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'created' => array(
'description' => 'The Unix timestamp when the coupon was created.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'changed' => array(
'description' => 'The Unix timestamp when the coupon was most recently saved.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'status' => array(
'description' => 'Whether or not this coupon is enabled.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'data' => array(
'type' => 'blob',
'size' => 'big',
'not null' => FALSE,
'serialize' => TRUE,
'description' => 'Everything else, serialized.',
),
),
'indexes' => array(
'uid' => array(
'uid',
),
),
'primary key' => array(
'coupon_id',
),
'foreign keys' => array(
'uid' => array(
'table' => 'users',
'columns' => array(
'uid' => 'uid',
),
),
),
'unique keys' => array(
'code' => array(
'code',
),
),
);
return $schema;
}