You are here

function push_notifications_update_7002 in Push Notifications 7

Implements hook_update_n.

File

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

Code

function push_notifications_update_7002() {
  $table = 'push_notifications_tokens';
  $field = 'token';

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

  // Recreate the field with the correct
  // length and upated
  $token_new = array(
    'description' => 'Device Token',
    'type' => 'varchar',
    'length' => '255',
    'not null' => TRUE,
  );
  $indexes_new = array(
    'primary key' => array(
      'token',
      'uid',
    ),
    'indexes' => array(
      'token' => array(
        'token',
      ),
    ),
  );
  db_change_field($table, $field, $field, $token_new, $indexes_new);
}