<?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,
      ),
      'data' => array(
        'description' => 'A serialized array of additional data.',
        'type' => 'text',
        'size' => 'big',
        'serialize' => TRUE,
      ),
    ),
    'primary key' => array('name'),
  );

  return $schema;
}
