You are here

function commerce_gc_schema in Commerce GC 7

File

./commerce_gc.install, line 11
Installs Giftcard transaction table and default fields.

Code

function commerce_gc_schema() {
  $schema['commerce_gc_transaction'] = array(
    'description' => 'The table for keeping track of giftcard transactions.',
    'fields' => array(
      'transaction_id' => array(
        'description' => 'The identifier for this transaction.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'coupon_id' => array(
        'description' => 'An identifier for a coupon.',
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
      ),
      'date' => array(
        'description' => 'The Unix timestamp when the transaction occurred.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'amount' => array(
        'description' => 'The transaction amount.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'status' => array(
        'description' => 'The status of this transaction (hold, completed, cancelled).',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'transaction_id',
    ),
    'indexes' => array(
      'coupon_id' => array(
        'coupon_id',
      ),
    ),
    'foreign keys' => array(
      'coupon_id' => array(
        'table' => 'commerce_coupon',
        'columns' => array(
          'coupon_id' => 'coupon_id',
        ),
      ),
    ),
  );
  return $schema;
}