You are here

function uc_product_power_tools_schema in Ubercart Product Power Tools 6.2

Same name and namespace in other branches
  1. 6 uc_product_power_tools.install \uc_product_power_tools_schema()
  2. 7 uc_product_power_tools.install \uc_product_power_tools_schema()

Implements hook_schema().

File

./uc_product_power_tools.install, line 12
Install, update, and uninstall functions for the uc_product_power_tools module.

Code

function uc_product_power_tools_schema() {
  $schema = array();
  $schema['uc_power_tools'] = array(
    'description' => t('Table for settings of Ubercart Product Power Tools module.'),
    'fields' => array(
      'pcid' => array(
        'description' => 'Product class ID',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'enabled' => array(
        'description' => 'Boolean',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      // Auto SKU Generation Boolean on/off setting & replacement pattern
      'asku' => array(
        'description' => 'Boolean',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => FALSE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'asku_settings' => array(
        'description' => 'Replacement pattern',
        'type' => 'text',
        'not null' => FALSE,
      ),
      // List Price Boolean on/off setting & default price
      'lp' => array(
        'description' => 'Boolean',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'lp_settings' => array(
        'description' => 'Default list price value',
        'type' => 'numeric',
        'precision' => 15,
        'scale' => 3,
        'not null' => TRUE,
        'default' => 0.0,
      ),
      // Cost Boolean on/off setting & default price
      'cost' => array(
        'description' => 'Boolean',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'cost_settings' => array(
        'description' => 'Default cost value',
        'type' => 'numeric',
        'precision' => 15,
        'scale' => 3,
        'not null' => TRUE,
        'default' => 0.0,
      ),
      // Sell Price Boolean on/off setting & default price
      'sp' => array(
        'description' => 'Boolean',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'sp_settings' => array(
        'description' => 'Default sell price value',
        'type' => 'numeric',
        'precision' => 15,
        'scale' => 3,
        'not null' => TRUE,
        'default' => 0.0,
      ),
      // Default Qty Boolean on/off setting & default qty value
      'dq' => array(
        'description' => 'Boolean',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'dq_settings' => array(
        'description' => 'Default quantity value',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 1,
      ),
      // Package Qty Boolean on/off setting & default qty value
      'pq' => array(
        'description' => 'Boolean',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'pq_settings' => array(
        'description' => 'Default package quantity value',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 1,
      ),
      // Shipping: 0 - Disable, 1 - Hide Checkbox & other shipping fields, 2 - Hide checkbox and show other shipping fields
      'ship' => array(
        'description' => 'Shippable setting',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      // List Position Boolean on/off setting & default position value
      'lpos' => array(
        'description' => 'Boolean',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'lpos_settings' => array(
        'description' => 'Default list position value',
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      // Stock Boolean on/off setting & default stock level (if stock module is installed)
      'stock' => array(
        'description' => 'Boolean',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'stock_settings' => array(
        'description' => 'Default stock value',
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'stock_threshold' => array(
        'description' => 'Stock threshold',
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'weight' => array(
        'description' => 'Weight',
        'type' => 'float',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'weight_units' => array(
        'description' => 'Weight units',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => 'lb',
      ),
      'length' => array(
        'description' => 'Length',
        'type' => 'float',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'width' => array(
        'description' => 'Width',
        'type' => 'float',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'height' => array(
        'description' => 'Height',
        'type' => 'numeric',
        'precision' => 15,
        'scale' => 3,
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'length_units' => array(
        'description' => 'Size units',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => 'in',
      ),
    ),
    'primary key' => array(
      'pcid',
    ),
  );
  return $schema;
}