You are here

function payment_update_7104 in Payment 7

Updates NOT NULL and default value configuration for some database columns.

File

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

Code

function payment_update_7104(array &$sandbox) {
  db_change_field('payment', 'currency_code', 'currency_code', array(
    'type' => 'varchar',
    'length' => 3,
    'default' => 'XXX',
    'not null' => TRUE,
  ));
  db_change_field('payment', 'description', 'description', array(
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
  ));
  db_change_field('payment', 'finish_callback', 'finish_callback', array(
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
  ));
  db_change_field('payment_line_item', 'amount', 'amount', array(
    'type' => 'float',
    'size' => 'big',
    'not null' => TRUE,
  ));
  db_query('UPDATE {payment_line_item} SET amount_total = amount * quantity * (tax_rate + 1)');
  db_change_field('payment_line_item', 'amount_total', 'amount_total', array(
    'type' => 'float',
    'size' => 'big',
    'not null' => TRUE,
  ));
  db_change_field('payment_line_item', 'quantity', 'quantity', array(
    'type' => 'int',
    'default' => 1,
    'not null' => TRUE,
  ));
  db_change_field('payment_line_item', 'tax_rate', 'tax_rate', array(
    'type' => 'float',
    'size' => 'big',
    'default' => 0.0,
    'not null' => TRUE,
  ));
  db_change_field('payment_method', 'enabled', 'enabled', array(
    'type' => 'int',
    'size' => 'tiny',
    'default' => 0,
    'not null' => TRUE,
  ));
  db_change_field('payment_method', 'status', 'status', array(
    'type' => 'int',
    'size' => 'tiny',
    'default' => ENTITY_CUSTOM,
    'not null' => TRUE,
  ));
  db_change_field('payment_status_item', 'status', 'status', array(
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
  ));
  db_change_field('payment_status_item', 'created', 'created', array(
    'type' => 'int',
    'not null' => TRUE,
  ));
}