You are here

currency_api.install in Currency 7

This module provides an API for currency conversion.

File

currency_api/currency_api.install
View source
<?php

/**
 * @file
 *   This module provides an API for currency conversion.
 */

/**
 * Implements hook_schema().
 *
 * Define schema for currencyapi database
 */
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;
}

/**
 * Implements hook_uninstall().
 *
 * This will automatically remove the variables defined by Currency API.
 */
function currency_api_uninstall() {
  db_query("DELETE FROM {variable} WHERE name LIKE 'currency_api%'");
}

Functions