You are here

function uc_cart_schema in Ubercart 6.2

Same name and namespace in other branches
  1. 7.3 uc_cart/uc_cart.install \uc_cart_schema()

Implements hook_schema().

File

uc_cart/uc_cart.install, line 11
Install hooks for uc_cart.module.

Code

function uc_cart_schema() {
  $schema = array();
  $schema['uc_cart_products'] = array(
    'description' => 'Stores products placed in shopping carts.',
    'fields' => array(
      'cart_item_id' => array(
        'description' => 'Unique identifier for cart item.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'cart_id' => array(
        'description' => 'A user-specific cart ID. For authenticated users, their {users}.uid. For anonymous users, a token.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '0',
      ),
      'nid' => array(
        'description' => 'The {node}.nid of the product.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'qty' => array(
        'description' => 'The number of this product in the cart.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'changed' => array(
        'description' => 'The Unix timestamp indicating the time the product in the cart was changed.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'data' => array(
        'description' => 'A serialized array of extra cart data for the product.',
        'type' => 'text',
        'serialize' => TRUE,
      ),
    ),
    'indexes' => array(
      'cart_id' => array(
        'cart_id',
      ),
    ),
    'primary key' => array(
      'cart_item_id',
    ),
  );
  return $schema;
}