You are here

function uc_recurring_update_1 in Ubercart 5

File

payment/uc_recurring/uc_recurring.install, line 75

Code

function uc_recurring_update_1() {
  $ret = array();

  // Add a column to store the recurring fee handler with the user subscription.
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("ALTER TABLE {uc_recurring_users} ADD fee_handler VARCHAR(255) NOT NULL AFTER uid");
      break;
    case 'pgsql':
      db_add_column($ret, 'uc_recurring_users', 'fee_handler', 'varchar(255)', array(
        'not null' => TRUE,
        'default' => "''",
      ));
      break;
  }

  // Update existing rows if uc_recurring is the current handler.
  if (variable_get('uc_recurring_handler', 'uc_recurring') == 'uc_recurring') {
    $ret[] = update_sql("UPDATE {uc_recurring_users} SET fee_handler = 'uc_recurring'");
  }
  return $ret;
}