You are here

function payment_update_7102 in Payment 7

Adds the description_arguments field to {payment}.

File

./payment.install, line 303
Installation and uninstallation functions.

Code

function payment_update_7102(&$sandbox) {

  // A blob column cannot have a default value, so we need to update existing
  // rows in a separate update query. However, making the column NOT NULL from
  // the start causes data truncation errors, so we do that afterwards.
  db_add_field('payment', 'description_arguments', array(
    'type' => 'blob',
    'size' => 'big',
    'serialize' => TRUE,
  ));
  db_update('payment')
    ->fields(array(
    'description_arguments' => 'a:0:{}',
  ))
    ->execute();
  db_change_field('payment', 'description_arguments', 'description_arguments', array(
    'type' => 'blob',
    'size' => 'big',
    'serialize' => TRUE,
    'not null' => TRUE,
  ));
}