You are here

function commerce_recurring_schema in Commerce Recurring Framework 7.2

Implements hook_schema().

File

./commerce_recurring.install, line 10

Code

function commerce_recurring_schema() {
  $schema = array();
  $schema['commerce_recurring'] = array(
    'description' => 'The base table for commerce recurring entities.',
    'fields' => array(
      'id' => array(
        'description' => 'The primary identifier for a recurring entity, used internally only.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'type' => array(
        'description' => 'The type (bundle) of this recurring entity.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'uid' => array(
        'description' => 'The {users}.uid that owns the recurring entity.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'status' => array(
        'description' => 'Boolean indicating whether or not the recurring entity is active.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 1,
      ),
      'start_date' => array(
        'description' => 'The Unix timestamp when the recurring entity was created.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'due_date' => array(
        'description' => 'The Unix timestamp when the recurring entity has is next due date.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'end_date' => array(
        'description' => 'The Unix timestamp when the recurring entity ends being active.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'quantity' => array(
        'type' => 'numeric',
        'size' => 'normal',
        'not null' => TRUE,
        'default' => 0,
        'precision' => 10,
        'scale' => 2,
      ),
      'data' => array(
        'type' => 'blob',
        'not null' => FALSE,
        'size' => 'big',
        'serialize' => TRUE,
        'description' => 'A serialized array of additional data.',
      ),
    ),
    'primary key' => array(
      'id',
    ),
    'indexes' => array(
      'commerce_recurring_type' => array(
        'type',
      ),
      'uid' => array(
        'uid',
      ),
    ),
    'foreign keys' => array(
      'creator' => array(
        'table' => 'users',
        'columns' => array(
          'uid' => 'uid',
        ),
      ),
    ),
  );
  return $schema;
}