You are here

uc_quote.install in Ubercart 8.4

Install, update and uninstall functions for the uc_quote module.

File

shipping/uc_quote/uc_quote.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the uc_quote module.
 */

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

Functions

Namesort descending Description
uc_quote_schema Implements hook_schema().