You are here

function uc_recurring_update_6006 in UC Recurring Payments and Subscriptions 7.2

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

Change null intervals to -1. Add product and product node ID to recurring users table.

File

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

Code

function uc_recurring_update_6006() {

  // 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
  db_query('UPDATE {uc_recurring_users} SET remaining_intervals = -1 WHERE remaining_intervals IS NULL');
  db_query('UPDATE {uc_recurring_products} SET number_intervals = -1 WHERE number_intervals IS NULL');
  db_change_field('uc_recurring_users', 'remaining_intervals', 'remaining_intervals', array(
    'description' => 'The remaining number of times the fee should be charged.',
  ) + $intervals);
  db_change_field('uc_recurring_products', 'number_intervals', 'number_intervals', array(
    'description' => 'The number of times the fee should be charged.',
  ) + $intervals);
  db_add_field('uc_recurring_users', 'order_product_id', array(
    'description' => 'The product ID.',
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 0,
  ));
  db_add_field('uc_recurring_users', 'own_handler', array(
    'description' => '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('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,
  ));
}