You are here

function bean_uuid_update_7202 in Bean (for Drupal 7) 7

Remove duplicate vuuid field values on inactive bean revisions.

File

bean_uuid/bean_uuid.install, line 60
Bean UUID installation and schema hooks.

Code

function bean_uuid_update_7202() {

  // Retrieve all active vid values for subquery.
  $subquery = db_select('bean', 'b')
    ->fields('b', array(
    'vid',
  ));

  // Remove duplicate UUID values on inactive vuuid values.
  $fields = array(
    'vuuid' => '',
  );
  $query = db_update('bean_revision')
    ->fields($fields)
    ->condition('vid', $subquery, 'NOT IN')
    ->execute();
}