You are here

function simplenews_scheduler_schema in Simplenews Scheduler 7

Same name and namespace in other branches
  1. 8 simplenews_scheduler.install \simplenews_scheduler_schema()
  2. 6.2 simplenews_scheduler.install \simplenews_scheduler_schema()
  3. 6 simplenews_scheduler.install \simplenews_scheduler_schema()
  4. 2.0.x simplenews_scheduler.install \simplenews_scheduler_schema()

Implements hook_schema().

File

./simplenews_scheduler.install, line 11
Install and uninstall functions for the Simplenews Scheduler module.

Code

function simplenews_scheduler_schema() {
  $schema['simplenews_scheduler'] = array(
    'description' => 'Scheduled newsletter data.',
    'fields' => array(
      'nid' => array(
        'description' => 'The node id for a scheduled newsletter.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'last_run' => array(
        'description' => 'The timestamp the scheduled newsletter was last sent.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'next_run' => array(
        'description' => 'The future timestamp the next scheduled newsletter is due to be sent.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'activated' => array(
        'description' => 'Whether the schedule is active.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'send_interval' => array(
        'description' => 'The interval at which to send, as a text string.',
        'type' => 'varchar',
        'length' => 10,
      ),
      'interval_frequency' => array(
        'description' => 'The number of intervals between newsletter transmission.',
        'type' => 'int',
        'default' => 1,
        'not null' => TRUE,
      ),
      'start_date' => array(
        'description' => 'The timestamp at which to start sending editions.',
        'type' => 'int',
        'not null' => TRUE,
      ),
      'stop_type' => array(
        'description' => 'How to determine when to stop sending editions.',
        'type' => 'int',
        'not null' => TRUE,
      ),
      'stop_date' => array(
        'description' => 'The timestamp at which to stop sending editions.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 1388447999,
      ),
      'stop_edition' => array(
        'description' => 'The edition count at which to stop sending editions.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'php_eval' => array(
        'description' => 'PHP code to evaluate to determine whether to send an edition.',
        'type' => 'blob',
        'not null' => TRUE,
      ),
      'title' => array(
        'description' => 'The title of new edition nodes.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'nid',
    ),
  );
  $schema['simplenews_scheduler_editions'] = array(
    'description' => 'Stores data for each edition of a scheduled newsletter.',
    'fields' => array(
      'eid' => array(
        'description' => 'The node id for the edition.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'pid' => array(
        'description' => 'The node id for the parent scheduled newsletter node.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'date_issued' => array(
        'description' => 'The timestamp on which this edition was sent.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'eid',
    ),
  );
  return $schema;
}