You are here

function stripe_customer_schema in Stripe 7

Implements hook_schema().

File

stripe_customer/stripe_customer.install, line 11
Drupal install hooks.

Code

function stripe_customer_schema() {
  $schema['stripe_customers'] = array(
    'description' => 'Stripe customer objects.',
    'fields' => array(
      'cid' => array(
        'type' => 'serial',
        'description' => 'Internal Customer ID',
        'not null' => TRUE,
      ),
      'uid' => array(
        'description' => 'User ID',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'customer_id' => array(
        'description' => 'The Stripe Customer ID',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'livemode' => array(
        'description' => 'Boolean indicating whether the record came from live or test.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'created' => array(
        'description' => 'Date the customer was created in Stripe.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'changed' => array(
        'description' => 'Date this record was last synced with Stripe.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'default_source' => array(
        'description' => 'The default source for this Customer',
        'type' => 'varchar',
        'length' => 32,
        'not null' => FALSE,
      ),
      'currency' => array(
        'description' => 'Currency for this Customer',
        'type' => 'varchar',
        'length' => 32,
        'not null' => FALSE,
      ),
      'status' => array(
        'description' => 'Whether this customer is active. Default is true.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 1,
      ),
    ),
    'indexes' => array(
      'customer_id' => array(
        'livemode',
        'customer_id',
        'uid',
      ),
    ),
    'primary key' => array(
      'cid',
    ),
    'foreign keys' => array(
      'uid' => array(
        'table' => 'users',
        'column' => array(
          'uid' => 'uid',
        ),
      ),
    ),
  );
  return $schema;
}