You are here

function currency_api_schema in Currency 6

Same name and namespace in other branches
  1. 7 currency_api/currency_api.install \currency_api_schema()

Implementation of hook_schema().

Define schema for currencyapi database

File

currency_api/currency_api.install, line 22
This module provides an API for currency conversion.

Code

function currency_api_schema() {
  $schema['currencyapi'] = array(
    'description' => 'Table to cache currency rates that have been looked up by the Currency API module.',
    'fields' => array(
      'currency_from' => array(
        'description' => 'ISO 4217 3-character currency code for destination currency, as a character string.',
        'type' => 'varchar',
        'length' => 10,
        'not null' => TRUE,
        'default' => '',
      ),
      'currency_to' => array(
        'description' => 'ISO 4217 3-character currency code for destination currency, as a character string.',
        'type' => 'varchar',
        'length' => 10,
        'not null' => TRUE,
        'default' => '',
      ),
      'rate' => array(
        'description' => 'Conversion rate, currency_to per currency_from, as a floating point number.',
        'type' => 'float',
        'size' => 'normal',
        'not null' => TRUE,
        'default' => 0,
      ),
      'timestamp' => array(
        'description' => 'The time that the conversion rate was created, or last edited by its author, as a Unix timestamp.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'currency_from',
      'currency_to',
    ),
  );
  return $schema;
}