You are here

function mailing_list_schema in Mailing List 6

Same name and namespace in other branches
  1. 7 mailing_list.install \mailing_list_schema()

Implementation of hook_schema().

File

./mailing_list.install, line 26
Install and update functions for mailing_list.

Code

function mailing_list_schema() {
  $schema = array();
  $schema['mailing_list'] = array(
    'description' => t('A mailing list consisting of names and e-mails.'),
    'fields' => array(
      'mlid' => array(
        'description' => 'The primary identifier for a mailing list.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'name' => array(
        'description' => t('The title of this mailing list.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'mlid',
    ),
    'indexes' => array(
      'name' => array(
        'name',
      ),
    ),
  );
  $schema['mailing_list_emails'] = array(
    'description' => t('An e-mail in a mailing list.'),
    'fields' => array(
      'eid' => array(
        'description' => 'The primary identifier for a mailing list e-mail.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'mlid' => array(
        'description' => t('The {mailing_list} this e-mail belongs to.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'mail' => array(
        'description' => t('The e-mail of this subscriber.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'name' => array(
        'description' => t('The name of this subscriber.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'eid',
    ),
    'indexes' => array(
      'mlid' => array(
        'mlid',
      ),
      'name' => array(
        'name',
      ),
      'mail' => array(
        'mail',
      ),
    ),
    'unique keys' => array(
      'mlid_mail' => array(
        'mlid',
        'mail',
      ),
    ),
  );
  return $schema;
}