function simplenews_schema in Simplenews 8
Same name and namespace in other branches
- 8.2 simplenews.install \simplenews_schema()
- 6.2 simplenews.install \simplenews_schema()
- 6 simplenews.install \simplenews_schema()
- 7.2 simplenews.install \simplenews_schema()
- 7 simplenews.install \simplenews_schema()
- 3.x simplenews.install \simplenews_schema()
Implements hook_schema().
File
- ./
simplenews.install, line 13 - Install, update and uninstall functions for the simplenews module
Code
function simplenews_schema() {
$schema['simplenews_mail_spool'] = array(
'description' => 'Spool for temporary storage of newsletter emails.',
'fields' => array(
'msid' => array(
'description' => 'The primary identifier for a mail spool record.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'mail' => array(
'description' => 'The formatted email address of mail message recipient.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'entity_type' => array(
'description' => 'The entity type of this newsletter issue.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'entity_id' => array(
'description' => 'The entity id of this newsletter issue.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'newsletter_id' => array(
'description' => 'The {simplenews_newsletter}.id this issue belongs to.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'status' => array(
'description' => 'The sent status of the email (0 = hold, 1 = pending, 2 = done).',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
),
'error' => array(
'description' => 'A boolean indicating whether an error occured while sending the email.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
'timestamp' => array(
'description' => 'The time status was set or changed.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'data' => array(
'type' => 'text',
'not null' => FALSE,
'size' => 'big',
'serialize' => TRUE,
'description' => 'A serialized array of name value pairs that are related to the email address.',
),
'snid' => array(
'description' => 'Foreign key for subscriber table ({simplenews_subscriber}.id)',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'msid',
),
'indexes' => array(
'newsletter_id' => array(
'newsletter_id',
),
'status' => array(
'status',
),
'snid_newsletter_id' => array(
'snid',
'newsletter_id',
),
),
'foreign keys' => array(
'newsletter_id' => array(
'table' => 'simplenews_newsletter',
'columns' => array(
'newsletter_id',
),
),
'snid_newsletter_id' => array(
'table' => 'simplenews_subscription',
'columns' => array(
'snid' => 'snid',
'newsletter_id' => 'newsletter_id',
),
),
),
);
return $schema;
}