You are here

uc_coupon.install in Ubercart Discount Coupons 7.2

Same filename and directory in other branches
  1. 5 uc_coupon.install
  2. 6 uc_coupon.install
  3. 7.3 uc_coupon.install

Ubercart uc_coupon.module schema

File

uc_coupon.install
View source
<?php

/**
 * @file
 * Ubercart uc_coupon.module schema
 */

/**
 * Implements hook_schema().
 */
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;
}

/**
 * Implements hook_uninstall().
 */
function uc_coupon_uninstall() {
  variable_del('uc_coupon_collapse_pane');
  variable_del('uc_coupon_default_usage');
  variable_del('uc_coupon_pane_description');
  variable_del('uc_coupon_purchase_order_status');
  variable_del('uc_coupon_querystring');
  variable_del('uc_coupon_show_in_cart');
  variable_del('uc_coupon_line_item_format');
  variable_del('uc_coupon_line_item_weight');
  variable_del('uc_coupon_form_components');
  variable_del('uc_coupon_allow_multiple');
  variable_del('uc_coupon_used_order_status');
}

/**
 * Implements hook_update_last_removed().
 * 
 */
function uc_coupon_update_last_removed() {
  return 6006;
}