function commerce_product_schema in Commerce Core 7
Implements hook_schema().
File
- modules/
product/ commerce_product.install, line 7
Code
function commerce_product_schema() {
$schema = array();
$schema['commerce_product'] = array(
'description' => 'The base table for products.',
'fields' => array(
'product_id' => array(
'description' => 'The primary identifier for a product, used internally only.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'revision_id' => array(
'description' => 'The current {commerce_product_revision}.revision_id version identifier.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
),
'sku' => array(
'description' => 'The unique, human-readable identifier for a product.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'title' => array(
'description' => 'The title of this product, always treated as non-markup plain text.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'type' => array(
'description' => 'The {commerce_product_type}.type of this product.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'language' => array(
'description' => 'The {languages}.language of this product.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'uid' => array(
'description' => 'The {users}.uid that created this product.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'status' => array(
'description' => 'Boolean indicating whether or not the product appears in lists and may be added to orders.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 1,
),
'created' => array(
'description' => 'The Unix timestamp when the product was created.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'changed' => array(
'description' => 'The Unix timestamp when the product was most recently saved.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'data' => array(
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
'serialize' => TRUE,
'description' => 'A serialized array of additional data.',
),
),
'primary key' => array(
'product_id',
),
'indexes' => array(
'product_type' => array(
'type',
),
'uid' => array(
'uid',
),
),
'unique keys' => array(
'sku' => array(
'sku',
),
'revision_id' => array(
'revision_id',
),
),
'foreign keys' => array(
'current_revision' => array(
'table' => 'commerce_product_revision',
'columns' => array(
'revision_id' => 'revision_id',
),
),
'creator' => array(
'table' => 'users',
'columns' => array(
'uid' => 'uid',
),
),
),
);
$schema['commerce_product_revision'] = array(
'description' => 'Saves information about each saved revision of a {commerce_product}.',
'fields' => array(
'product_id' => array(
'description' => 'The {commerce_product}.product_id of the product this revision belongs to.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'revision_id' => array(
'description' => 'The primary identifier for this revision.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'sku' => array(
'description' => 'The unique, human-readable identifier of a product for this revision.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'title' => array(
'description' => 'The title of this product for this revision',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'revision_uid' => array(
'description' => 'The {users}.uid that owns the product at this revision.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'status' => array(
'description' => 'The status of this revision.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 1,
),
'log' => array(
'description' => 'The log entry explaining the changes in this version.',
'type' => 'text',
'not null' => TRUE,
'size' => 'big',
),
'revision_timestamp' => array(
'description' => 'The Unix timestamp when this revision was created.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'data' => array(
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
'serialize' => TRUE,
'description' => 'A serialized array of additional data for this revision.',
),
),
'primary key' => array(
'revision_id',
),
'indexes' => array(
'product_id' => array(
'product_id',
),
'revision_uid' => array(
'revision_uid',
),
),
'foreign keys' => array(
'product' => array(
'table' => 'commerce_product',
'columns' => array(
'product_id' => 'product_id',
),
),
'owner' => array(
'table' => 'users',
'columns' => array(
'revision_uid' => 'uid',
),
),
),
);
return $schema;
}