You are here

function uc_recurring_update_6004 in UC Recurring Payments and Subscriptions 7.2

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

Additional schema tweaks, add {uc_recurring_schedule} and {uc_recurring_extensions}.

File

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

Code

function uc_recurring_update_6004() {
  db_add_field('uc_recurring_users', 'attempts', array(
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 0,
  ));
  db_add_field('uc_recurring_users', 'pfid', array(
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => FALSE,
    'default' => 0,
  ));
  db_change_field('uc_recurring_products', 'number_intervals', 'number_intervals', array(
    'type' => 'int',
    'size' => 'small',
    'unsigned' => TRUE,
    'not null' => FALSE,
    'default' => 1,
  ));
  db_change_field('uc_recurring_users', 'remaining_intervals', 'remaining_intervals', array(
    'type' => 'int',
    'size' => 'small',
    'unsigned' => TRUE,
    'not null' => FALSE,
    'default' => 1,
  ));
  $schema = array();
  $schema['uc_recurring_schedule'] = array(
    'description' => t('Data for handling more complex recurring schedules.'),
    'fields' => array(
      'pfid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'interval_num' => array(
        'description' => t('The number in the recurring schedule to.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'fee_amount' => array(
        'description' => t('The amount of the schedule fee to charge.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'next_interval' => array(
        'description' => t('The amount of time before next charge.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '0',
      ),
      'rfid' => array(
        'description' => t('The specific id of the recurring fee to effect, NULL to effect all recurring fees.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
      ),
    ),
    'primary key' => array(
      'pfid',
      'interval_num',
    ),
  );
  $schema['uc_recurring_extensions'] = array(
    'description' => t('Data for handling extensions to recurring fees.'),
    'fields' => array(
      'pfid' => array(
        'description' => t('The schedule ID that this extension relates to.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'rebill_attempt' => array(
        'description' => t('The rebill attempt number.'),
        'type' => 'int',
        'size' => 'small',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'time_to_extend' => array(
        'description' => t('Time in seconds to extend a recurring fee before next charge.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
  );
  db_create_table('uc_recurring_schedule', $schema['uc_recurring_schedule']);
  db_create_table('uc_recurring_extensions', $schema['uc_recurring_extensions']);
}