You are here

function mail_logger_schema in Mail Logger 7

Same name and namespace in other branches
  1. 6 mail_logger.install \mail_logger_schema()

Implementation of hook_schema().

File

./mail_logger.install, line 10
Install, update and uninstall functions for the mail_logger module.

Code

function mail_logger_schema() {
  $schema = array();
  $schema['mail_logger'] = array(
    'description' => 'Mail Logger table stores outgoing mails',
    'fields' => array(
      'mlid' => array(
        'description' => 'Mail Logger entry ID',
        'type' => 'serial',
        'not null' => TRUE,
        'unsigned' => TRUE,
      ),
      'mailkey' => array(
        'description' => 'a key identifying the mail type',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'mailto' => array(
        'description' => 'to whom this mail is going',
        'type' => 'text',
        'size' => 'medium',
        /* up to 16MB */
        'not null' => TRUE,
      ),
      'subject' => array(
        'description' => 'Mail subject',
        'type' => 'varchar',
        'length' => 2047,
        'not null' => TRUE,
      ),
      'body' => array(
        'description' => 'Body text of the mail',
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
      ),
      'mailfrom' => array(
        'description' => 'the FROM email address',
        'type' => 'varchar',
        'length' => 2047,
        'not null' => TRUE,
      ),
      'headers' => array(
        'description' => 'Headers of the outgoing mail',
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
      ),
      'date_sent' => array(
        'description' => 'Mail Logger entry ID',
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
      ),
      'language' => array(
        'description' => 'Language code',
        'type' => 'varchar',
        'length' => 20,
        'not null' => TRUE,
      ),
      'ipaddr' => array(
        'description' => 'IP Address of User',
        'type' => 'varchar',
        'length' => 45,
        // Long enough for IPv6.
        'not null' => TRUE,
      ),
      'mail_system' => array(
        'description' => 'Mail System Class',
        'type' => 'varchar',
        'length' => 128,
      ),
    ),
    'primary key' => array(
      'mlid',
    ),
    'indexes' => array(
      'mailto' => array(
        array(
          'mailto',
          200,
        ),
      ),
      'mailfrom' => array(
        array(
          'mailfrom',
          100,
        ),
      ),
      'mail_system' => array(
        'mail_system',
      ),
      'subject' => array(
        array(
          'subject',
          20,
        ),
      ),
      'date_sent' => array(
        'date_sent',
      ),
      'language' => array(
        'language',
      ),
      'ipaddr' => array(
        'ipaddr',
      ),
    ),
  );
  return $schema;
}