You are here

function push_notifications_update_7004 in Push Notifications 7

Implements hook_update_n.

Add auto-increment field to push_notifications_tokens table for integration with Views.

File

./push_notifications.install, line 205
Install files for Push Notifications module.

Code

function push_notifications_update_7004() {
  $table = 'push_notifications_tokens';

  // Drop all indexes using the token field.
  db_drop_primary_key($table);

  // Add id field.
  $id_field_spec = array(
    'description' => t('Push Notification auto-increment ID.'),
    'type' => 'serial',
    'not null' => TRUE,
  );
  $id_field_index = array(
    'primary key' => array(
      'id',
    ),
  );
  db_add_field($table, 'id', $id_field_spec, $id_field_index);

  // Add token_uid index.
  db_add_index($table, 'token_uid', array(
    'token',
    'uid',
  ));
}