You are here

uc_cart_links.install in Ubercart 7.3

Install, update and uninstall functions for the uc_cart_links module.

File

uc_cart_links/uc_cart_links.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the uc_cart_links module.
 */

/**
 * Implements hook_schema().
 */
function uc_cart_links_schema() {
  $schema['uc_cart_link_clicks'] = array(
    'description' => 'Stores information for cart links.',
    'fields' => array(
      'cart_link_id' => array(
        'description' => 'The cart link identifier.',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '0',
      ),
      'clicks' => array(
        'description' => 'The number of times this cart link was clicked.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'last_click' => array(
        'description' => 'The time of the last click on this cart link, stored as a UNIX timestamp.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'cart_link_id',
    ),
  );
  return $schema;
}

/**
 * Implements hook_uninstall().
 */
function uc_cart_links_uninstall() {
  db_delete('variable')
    ->condition('name', 'uc_cart_links_%', 'LIKE')
    ->execute();
  cache_clear_all('variables', 'cache_bootstrap');
}

/**
 * Implements hook_update_last_removed().
 */
function uc_cart_links_update_last_removed() {
  return 6001;
}