You are here

function newsletter_schema in Newsletter 7.2

Same name and namespace in other branches
  1. 7 newsletter.install \newsletter_schema()

Implements hook_schema().

File

./newsletter.install, line 30
Contains install,uninstall and update functions for Newsletter module.

Code

function newsletter_schema() {
  $schema = array();
  $schema['newsletter'] = array(
    'description' => 'Contains the newsletters that are sent.',
    'fields' => array(
      'newsletter_id' => array(
        'description' => 'The primary identifier for a newsletter.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'send_id' => array(
        'description' => 'The # of sent times.',
        'type' => 'int',
        'not null' => FALSE,
        'default' => 0,
      ),
      'list_id' => array(
        'description' => 'The {newsletter_list}.list_id this newsletter was sent to.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'nid' => array(
        'description' => 'The {node}.nid of the newsletter issue.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'subject' => array(
        'description' => 'The newsletter\'s subject.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'sent' => array(
        'description' => 'The sent timestamp of this newsletter.',
        'type' => 'int',
        'not null' => FALSE,
        'default' => 0,
      ),
    ),
    'indexes' => array(
      'newsletter_send_id' => array(
        'send_id',
      ),
    ),
    'foreign keys' => array(
      'tracked_list' => array(
        'table' => 'newsletter_list',
        'columns' => array(
          'list_id' => 'list_id',
        ),
      ),
      'tracked_node' => array(
        'table' => 'node',
        'columns' => array(
          'nid' => 'nid',
        ),
      ),
    ),
    'primary key' => array(
      'newsletter_id',
    ),
  );
  return $schema;
}