You are here

uc_recurring_product.install in UC Recurring Payments and Subscriptions 6.2

Same filename and directory in other branches
  1. 7.2 modules/uc_recurring_product/uc_recurring_product.install

Installs the Recurring Products module.

File

modules/uc_recurring_product/uc_recurring_product.install
View source
<?php

/**
 * @file
 * Installs the Recurring Products module.
 */

/**
 * Implementation hook_schema().
 */
function uc_recurring_product_schema() {
  $schema = array();
  $schema['uc_recurring_product'] = array(
    'description' => t('Data for recurring fees attached to products.'),
    'fields' => array(
      'pfid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'model' => array(
        'description' => t('The SKU the recurring fee applies to.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '0',
      ),
      'fee_amount' => array(
        'description' => t('The amount of the recurring fee.'),
        'type' => 'numeric',
        'precision' => 15,
        'scale' => 3,
        'not null' => TRUE,
        'default' => 0.0,
      ),
      'initial_charge' => array(
        'description' => t('The amount of time between checkout and the first charge.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '0',
      ),
      'regular_interval' => array(
        'description' => t('The amount of time between charges.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '0',
      ),
      'number_intervals' => array(
        'description' => t('The number of times the fee should be charged.'),
        'type' => 'int',
        'size' => 'small',
        'unsigned' => FALSE,
        'not null' => TRUE,
        'default' => -1,
      ),
    ),
    'primary key' => array(
      'pfid',
    ),
  );
  return $schema;
}

/**
 * Implementation hook_install().
 */
function uc_recurring_product_install() {
  drupal_install_schema('uc_recurring_product');
}

/**
 * Implementation hook_uninstall().
 */
function uc_recurring_product_uninstall() {
  drupal_uninstall_schema('uc_recurring_product');
  db_query("DELETE FROM {variable} WHERE name LIKE 'uc_recurring_product_%%'");
  cache_clear_all('variables', 'cache');
}

/**
 * Remove nid field.
 */
function uc_recurring_product_update_6000() {
  $ret = array();
  db_drop_field($ret, 'uc_recurring_product', 'nid');
  return $ret;
}