You are here

function simple_package_tracking_schema in Simple Package Tracking 6

Same name and namespace in other branches
  1. 7 simple_package_tracking.install \simple_package_tracking_schema()

Implements hook_schema().

File

./simple_package_tracking.install, line 11
Install hooks for simple_package_tracking.module.

Code

function simple_package_tracking_schema() {
  $schema = array();
  $schema['tracking_numbers'] = array(
    'description' => 'Stores order tracking information.',
    'fields' => array(
      'tracking_id' => array(
        'description' => 'Primary key: the tracking ID.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'order_id' => array(
        'description' => 'The {uc_orders}.order_id.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'tracking_number' => array(
        'description' => 'A tracking number for a package related to the order.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
      'tracking_carrier' => array(
        'description' => 'The carrier for the package being tracked.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
      'tracking_url' => array(
        'description' => 'The URL to track the package with.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
    ),
    'primary key' => array(
      'tracking_id',
    ),
  );
  $schema['tracking_carriers'] = array(
    'description' => 'Stores order shipment carriers.',
    'fields' => array(
      'carrier_id' => array(
        'description' => 'Primary key: the carrier ID.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'carrier_name' => array(
        'description' => 'The human friendly name of the carrier.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
      'carrier_url_default' => array(
        'description' => 'A default URL pattern for displaying tracking number links.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
    ),
    'primary key' => array(
      'carrier_id',
    ),
  );
  return $schema;
}