view modules/contact/contact.install @ 1:c1f4ac30525a 6.0

Drupal 6.0
author Franck Deroche <webmaster@defr.org>
date Tue, 23 Dec 2008 14:28:28 +0100
parents
children 3edae6ecd6c6
line wrap: on
line source
<?php
// $Id: contact.install,v 1.10 2007/12/18 12:59:21 dries Exp $

/**
 * Implementation of hook_install().
 */
function contact_install() {
  // Create tables.
  drupal_install_schema('contact');
}

/**
 * Implementation of hook_uninstall().
 */
function contact_uninstall() {
  // Remove tables.
  drupal_uninstall_schema('contact');

  variable_del('contact_default_status');
  variable_del('contact_form_information');
  variable_del('contact_hourly_threshold');
}

/**
 * Implementation of hook_schema().
 */
function contact_schema() {
  $schema['contact'] = array(
    'description' => t('Contact form category settings.'),
    'fields' => array(
      'cid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => t('Primary Key: Unique category ID.'),
      ),
      'category' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => t('Category name.'),
      ),
      'recipients' => array(
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
        'description' => t('Comma-separated list of recipient e-mail addresses.'),
      ),
      'reply' => array(
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
        'description' => t('Text of the auto-reply message.'),
      ),
      'weight' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
        'description' => t("The category's weight."),
      ),
      'selected' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
        'description' => t('Flag to indicate whether or not category is selected by default. (1 = Yes, 0 = No)'),
      ),
    ),
    'primary key' => array('cid'),
    'unique keys' => array(
      'category' => array('category'),
    ),
    'indexes' => array(
      'list' => array('weight', 'category'),
    ),
  );

  return $schema;
}