You are here

function uc_recurring_update_6006 in UC Recurring Payments and Subscriptions 6.2

Same name and namespace in other branches
  1. 7.2 uc_recurring.install \uc_recurring_update_6006()

Add product and product node ID to recurring users table.

File

./uc_recurring.install, line 415
Installs the Recurring Fee module.

Code

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

  // Make remaining interval fields signable, so we can set it as -1, to
  // indicate unlimited recurring fees.
  $intervals = array(
    'type' => 'int',
    'size' => 'small',
    'unsigned' => FALSE,
    'not null' => TRUE,
    'default' => -1,
  );

  // make sure that the default value is already correct
  $sql = "UPDATE {uc_recurring_users} SET remaining_intervals = -1 WHERE remaining_intervals IS NULL";
  $ret[] = update_sql($sql);
  $sql = "UPDATE {uc_recurring_products} SET number_intervals = -1 WHERE number_intervals IS NULL";
  $ret[] = update_sql($sql);
  db_change_field($ret, 'uc_recurring_users', 'remaining_intervals', 'remaining_intervals', array(
    'description' => t('The remaining number of times the fee should be charged.'),
  ) + $intervals);
  db_change_field($ret, 'uc_recurring_products', 'number_intervals', 'number_intervals', array(
    'description' => t('The number of times the fee should be charged.'),
  ) + $intervals);
  db_add_field($ret, 'uc_recurring_users', 'order_product_id', array(
    'description' => 'The product ID.',
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 0,
  ));
  db_add_field($ret, 'uc_recurring_users', 'own_handler', array(
    'description' => t('Indicate if recurring fee is done by own handler, such as Paypal.'),
    'type' => 'int',
    'size' => 'small',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 0,
  ));
  db_add_field($ret, 'uc_recurring_products', 'nid', array(
    'description' => 'The ID of the node this role feature is attached to.',
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 0,
  ));
  return $ret;
}