function comment_update_8001

Create a UUID column for comments.

Related topics

File

drupal/core/modules/comment/comment.install, line 302
Install, update and uninstall functions for the Comment module.

Code

function comment_update_8001() {
  $spec = array(
    'description' => 'Unique Key: Universally unique identifier for this entity.',
    'type' => 'varchar',
    'length' => 128,
    'not null' => FALSE,
  );
  $keys = array(
    'unique keys' => array(
      'uuid' => array(
        'uuid',
      ),
    ),
  );

  // Account for sites having the contributed UUID module installed.
  if (db_field_exists('comment', 'uuid')) {
    db_change_field('comment', 'uuid', 'uuid', $spec, $keys);
  }
  else {
    db_add_field('comment', 'uuid', $spec, $keys);
  }
}