You are here

function simplenews_update_7205 in Simplenews 7.2

Replace nid with entity_type and entity_id columns in {simplenews_mail_spool}. Set the entity_type column on existing rows to node.

File

./simplenews.install, line 1101
Install, update and uninstall functions for the simplenews module

Code

function simplenews_update_7205() {
  db_change_field('simplenews_mail_spool', 'nid', 'entity_id', array(
    'description' => 'The entity id of this newsletter issue.',
    'type' => 'int',
    'not null' => TRUE,
    'default' => 0,
  ));
  db_add_field('simplenews_mail_spool', 'entity_type', array(
    'description' => 'The entity type of this newsletter issue.',
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
    'default' => '',
  ));

  // Set every entity type to 'node' at this point.
  db_update('simplenews_mail_spool')
    ->fields(array(
    'entity_type' => 'node',
  ))
    ->execute();
}