You are here

function simplenews_update_6254 in Simplenews 6.2

Add snid field to simplenews spool table.

File

./simplenews.install, line 898
Simplenews installation.

Code

function simplenews_update_6254() {
  $ret = array();
  db_add_field($ret, 'simplenews_mail_spool', 'snid', array(
    'description' => 'Foreign key for subscriber table ({simplenews_subscriptions}.snid)',
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 0,
  ));

  // populate snid for previous mail spool entries
  db_query("\n    UPDATE {simplenews_mail_spool} s\n    SET s.snid = (\n      SELECT snid\n      FROM {simplenews_subscriptions}\n      WHERE mail = s.mail\n      LIMIT 1\n    )");
  return $ret;
}