You are here

function uc_quote_schema in Ubercart 6.2

Same name and namespace in other branches
  1. 8.4 shipping/uc_quote/uc_quote.install \uc_quote_schema()
  2. 7.3 shipping/uc_quote/uc_quote.install \uc_quote_schema()

Implements hook_schema().

File

shipping/uc_quote/uc_quote.install, line 11
Install, update and uninstall functions for the uc_quote module.

Code

function uc_quote_schema() {
  $schema = array();
  $schema['uc_quote_shipping_types'] = array(
    'description' => 'Stores shipping information of products.',
    'fields' => array(
      'id_type' => array(
        'description' => 'Determines the table that id references. "product" => {uc_products}.nid.',
        'type' => 'varchar',
        'length' => 127,
        'not null' => TRUE,
        'default' => '',
      ),
      'id' => array(
        'description' => 'The entity ID.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'shipping_type' => array(
        'description' => 'The basic type of shipment, e.g.: small package, freight.',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'id_type',
      'id',
    ),
  );
  $schema['uc_quote_product_locations'] = array(
    'description' => 'Stores default product origin addresses.',
    'fields' => array(
      'nid' => array(
        'description' => 'The {uc_products}.nid.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'first_name' => array(
        'description' => 'The address first name.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'last_name' => array(
        'description' => 'The address last name.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'company' => array(
        'description' => 'The address company.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'street1' => array(
        'description' => 'The address street line 1.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'street2' => array(
        'description' => 'The address street line 2.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'city' => array(
        'description' => 'The address city.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'zone' => array(
        'description' => 'The address state/province, from {uc_zones}.zone_id.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'postal_code' => array(
        'description' => 'The address postal code.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'country' => array(
        'description' => 'The address country, from {uc_countries}.country_id.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'phone' => array(
        'description' => 'The address phone number.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'nid',
    ),
  );
  $schema['uc_order_quotes'] = array(
    'description' => 'Stores shipping quotes.',
    'fields' => array(
      'order_id' => array(
        'description' => 'The {uc_orders}.order_id.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'method' => array(
        'description' => 'The quoted shipping method.',
        'type' => 'varchar',
        'length' => 25,
        'not null' => TRUE,
        'default' => '',
      ),
      'accessorials' => array(
        'description' => 'Additional services or special instructions.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'rate' => array(
        'description' => 'The quoted shipping rate.',
        'type' => 'numeric',
        'precision' => 16,
        'scale' => 5,
        'not null' => TRUE,
        'default' => 0,
      ),
      'quote_form' => array(
        'description' => 'HTML form used to choose the shipping quote.',
        'type' => 'text',
      ),
    ),
    'unique keys' => array(
      'order_id_quote_method' => array(
        'order_id',
        'method',
      ),
    ),
  );
  return $schema;
}