You are here

newsletter_list.install in Newsletter 7.2

Contains install,uninstall and update functions for Newsletter module.

File

modules/list/newsletter_list.install
View source
<?php

/**
 * @file
 * Contains install,uninstall and update functions for Newsletter module.
 */

/**
 * Implements hook_install().
 */
function newsletter_list_install() {

  // Add template field?
}

/**
 * Implements hook_uninstall().
 */
function newsletter_list_uninstall() {
  foreach (field_read_instances(array(
    'entity_type' => 'newsletter_list',
  )) as $instance) {
    field_delete_instance($instance);
  }
  field_purge_batch(10);
}

/**
 * Implements hook_schema().
 */
function newsletter_list_schema() {
  $schema = array();
  $schema['newsletter_list'] = array(
    'description' => 'Contains the newsletter subscriber lists with their templates relations.',
    'fields' => array(
      'list_id' => array(
        'description' => 'The primary identifier of newsletter lists.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'title' => array(
        'description' => 'The list\'s title.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'last_sent' => array(
        'description' => 'Timestamp this list was last sent.',
        'type' => 'int',
        'not null' => FALSE,
      ),
      'send_again' => array(
        'description' => 'Timestamp this list needs to be sent again.',
        'type' => 'int',
        'not null' => FALSE,
      ),
      'created' => array(
        'description' => 'The creation timestamp of this subscriber.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'foreign keys' => array(
      'tracked_template' => array(
        'table' => 'newsletter_template',
        'columns' => array(
          'template_id' => 'template_id',
        ),
      ),
    ),
    'indexes' => array(
      'send_again' => array(
        'send_again',
      ),
    ),
    'primary key' => array(
      'list_id',
    ),
  );
  return $schema;
}