view notify/ad_notify.install @ 0:d8a3998dac8e ad

ajout module ad
author pierre
date Fri, 20 Feb 2009 14:04:09 +0000
parents
children 948362c2a207
line wrap: on
line source
<?php
// $Id: ad_notify.install,v 1.1.2.2.2.6.2.3 2009/02/16 17:06:49 jeremy Exp $

/**
 * @file
 * Ad_notify module database schema.
 *
 * Copyright (c) 2005-2009.
 *   Jeremy Andrews <jeremy@tag1consulting.com>.
 */

/**
 * Implementation of hook_schema().
 */
function ad_notify_schema() {
  $schema['ad_notify'] = array(
    'description' => 'The ad_notify table stores notifications data such as recepient, message body, event, etc.',
    'fields' => array(
      'notid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'aid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'oid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'event' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => ''
      ),
      'delay' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'queued' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'sent' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'counter' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'locked' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'expire' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'status' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'address' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
      ),
      'subject' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
      ),
      'body' => array(
        'type' => 'text',
        'not null' => FALSE,
      ),
    ),
    'primary key' => array('notid'),
    'unique keys' => array(
      'oid' => array('oid', 'event', 'delay'),
    ),
    'indexes' => array(
      'delay' => array('delay'),
      'event' => array('event'),
      'oid_2' => array('oid'),
      'queued' => array('queued'),
      'sent' => array('sent'),
      'status' => array('status'),
    ),
  );

  return $schema;
}

/**
 * ad_notify module installation.
 */
function ad_notify_install() {
  drupal_install_schema('ad_notify');
}


/**
 * Allow complete uninstallation of the ad_notify module.
 */
function ad_notify_uninstall() {
  // Remove tables.
  drupal_uninstall_schema('ad_notify');
}