You are here

function paymentreference_update_7100 in Payment 7

Deletes orphaned items from {paymentreference}.

File

modules/paymentreference/paymentreference.install, line 85
Installation and uninstallation functions.

Code

function paymentreference_update_7100(&$sandbox) {
  $pids = db_query("SELECT pr.pid FROM {paymentreference} pr LEFT JOIN {payment} p ON pr.pid = p.pid WHERE p.pid IS NULL")
    ->fetchCol();
  if ($pids) {
    db_delete('paymentreference')
      ->condition('pid', $pids)
      ->execute();
  }
}