commerce_flat_rate.install in Commerce Flat Rate 7
Defines the database schema for flat rate shipping services.
File
commerce_flat_rate.installView source
<?php
/**
* @file
* Defines the database schema for flat rate shipping services.
*/
/**
* Implements hook_schema().
*/
function commerce_flat_rate_schema() {
$schema = array();
$schema['commerce_flat_rate_service'] = array(
'description' => 'Stores information about shipping services created through the Flat Rate module.',
'fields' => array(
'name' => array(
'description' => 'The machine-name of the flat rate service.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'title' => array(
'description' => 'The human-readable title of the flat rate service.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'display_title' => array(
'description' => 'The title of the flat rate service displayed to customers.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'description' => array(
'description' => 'A brief description of the flat rate service.',
'type' => 'text',
'not null' => TRUE,
'size' => 'medium',
),
'rules_component' => array(
'description' => 'Boolean indicating whether or not this service should have a default Rules component for enabling it for orders.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
'amount' => array(
'description' => 'The amount of the base rate of the service.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'currency_code' => array(
'description' => 'The currency code of the base rate of the service.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
),
'weight' => array(
'description' => 'The weight value used to sort the flat rate services.',
'type' => 'int',
'not null' => TRUE,
'default' => 1,
'size' => 'small',
),
'data' => array(
'description' => 'A serialized array of additional data.',
'type' => 'text',
'size' => 'big',
'serialize' => TRUE,
),
),
'primary key' => array(
'name',
),
);
return $schema;
}
/**
* Implements hook_uninstall().
*/
function commerce_flat_rate_uninstall() {
variable_del('commerce_flat_rate_default_service');
}
/**
* Adds a weight column to the flat rate service table for sorting the services.
*/
function commerce_flat_rate_update_7200() {
$field_schema = array(
'description' => 'The weight value used to sort the flat rate services.',
'type' => 'int',
'not null' => TRUE,
'default' => 1,
'size' => 'small',
);
db_add_field('commerce_flat_rate_service', 'weight', $field_schema);
return t('Weight column added to the flat rate service table.');
}
Functions
Name | Description |
---|---|
commerce_flat_rate_schema | Implements hook_schema(). |
commerce_flat_rate_uninstall | Implements hook_uninstall(). |
commerce_flat_rate_update_7200 | Adds a weight column to the flat rate service table for sorting the services. |