123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- <?php
- /**
- * @file
- * Install, update and uninstall functions for the uc_quote module.
- */
- /**
- * Implements hook_schema().
- */
- 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'),
- 'foreign keys' => array(
- 'uc_products' => array(
- 'table' => 'uc_products',
- 'columns' => array('nid' => '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,
- ),
- ),
- 'primary key' => array('order_id'),
- 'unique keys' => array(
- 'order_id_quote_method' => array('order_id', 'method'),
- ),
- 'foreign keys' => array(
- 'uc_orders' => array(
- 'table' => 'uc_orders',
- 'columns' => array('order_id' => 'order_id'),
- ),
- ),
- );
- return $schema;
- }
- /**
- * Implements hook_uninstall().
- */
- function uc_quote_uninstall() {
- db_delete('variable')
- ->condition('name', 'uc_quote_%', 'LIKE')
- ->execute();
- variable_del('uc_store_shipping_type');
- }
- /**
- * Implements hook_update_last_removed().
- */
- function uc_quote_update_last_removed() {
- return 6004;
- }
- /**
- * Drops {uc_order_quotes}.quote_form.
- */
- function uc_quote_update_7001() {
- db_drop_field('uc_order_quotes', 'quote_form');
- }
|