You are here

function uc_coupon_schema in Ubercart Discount Coupons 7.2

Same name and namespace in other branches
  1. 6 uc_coupon.install \uc_coupon_schema()
  2. 7.3 uc_coupon.install \uc_coupon_schema()

Implements hook_schema().

File

./uc_coupon.install, line 11
Ubercart uc_coupon.module schema

Code

function uc_coupon_schema() {
  $schema = array();
  $schema['uc_coupons'] = array(
    'description' => 'Ubercart Coupons',
    'fields' => array(
      'cid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'code' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => TRUE,
        'default' => '',
      ),
      'value' => array(
        'type' => 'numeric',
        'precision' => 10,
        'scale' => 2,
        'not null' => TRUE,
        'default' => 0,
      ),
      'type' => array(
        'type' => 'varchar',
        'length' => '12',
        'not null' => TRUE,
        'default' => 'price',
      ),
      'status' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 1,
      ),
      'valid_from' => array(
        'type' => 'int',
      ),
      'valid_until' => array(
        'type' => 'int',
      ),
      'max_uses' => array(
        'type' => 'int',
        'size' => 'small',
        'not null' => TRUE,
        'default' => 0,
      ),
      'minimum_order' => array(
        'type' => 'numeric',
        'precision' => 10,
        'scale' => 2,
        'not null' => TRUE,
        'default' => 0,
      ),
      'data' => array(
        'type' => 'text',
        'serialize' => TRUE,
      ),
      'bulk' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'bulk_seed' => array(
        'type' => 'char',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'created' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'cid',
    ),
  );
  $schema['uc_coupons_orders'] = array(
    'description' => 'Ubercart Coupons used on Orders',
    'fields' => array(
      'cuid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'cid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'oid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'value' => array(
        'type' => 'numeric',
        'precision' => 10,
        'scale' => 2,
        'not null' => TRUE,
        'default' => 0,
      ),
      'code' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'cuid',
    ),
  );
  return $schema;
}