You are here

simple_package_tracking.install in Simple Package Tracking 7

Same filename and directory in other branches
  1. 6 simple_package_tracking.install

Install hooks for simple_package_tracking.module.

File

simple_package_tracking.install
View source
<?php

/**
 * @file
 * Install hooks for simple_package_tracking.module.
 */

/**
 * Implements hook_schema().
 */
function simple_package_tracking_schema() {
  $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 order ID',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'tracking_number' => array(
        'description' => 'A tracking number 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,
      ),
      'tracking_note' => array(
        'description' => 'Short extra note, such as the date the item was shipped.',
        '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,
        // Must equal carriers_add_form $form['carrier_url'] #maxlength field
        'not null' => FALSE,
      ),
      'weight' => array(
        'description' => 'A weight to set the position of a carrier in a list',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'carrier_id',
    ),
  );
  return $schema;
}

/**
 * Implements hook_install().
 */
function simple_package_tracking_install() {
}

/**
 * Implements hook_uninstall().
 */
function simple_package_tracking_uninstall() {
  variable_del('simple_package_tracking_default_note_text');
  variable_del('simple_package_tracking_allow_all_shipping_fields');
}

/**
 * Adds tracking_note field to the tracking_numbers table.
 */
function simple_package_tracking_update_7101() {
  $spec = array(
    'description' => 'Any short extra note, such as the date the item was shipped.',
    'type' => 'varchar',
    'length' => 255,
    'not null' => FALSE,
  );
  db_add_field('tracking_numbers', 'tracking_note', $spec);
}

Functions

Namesort descending Description
simple_package_tracking_install Implements hook_install().
simple_package_tracking_schema Implements hook_schema().
simple_package_tracking_uninstall Implements hook_uninstall().
simple_package_tracking_update_7101 Adds tracking_note field to the tracking_numbers table.