You are here

views_calc.install in Views Calc 7

Same filename and directory in other branches
  1. 5 views_calc.install
  2. 6.3 views_calc.install
  3. 6 views_calc.install

Install, update and uninstall functions for the views_calc module.

File

views_calc.install
View source
<?php

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

/**
 * Implements hook_schema().
 */
function views_calc_schema() {
  $schema['views_calc_fields'] = array(
    'fields' => array(
      'cid' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'disp-width' => '10',
      ),
      'label' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
      ),
      'format' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
      ),
      'custom' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
      ),
      'base' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
      ),
      'tablelist' => array(
        'type' => 'text',
        'not null' => TRUE,
      ),
      'fieldlist' => array(
        'type' => 'text',
        'not null' => TRUE,
      ),
      'calc' => array(
        'type' => 'text',
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'cid',
    ),
    'indexes' => array(
      'cid' => array(
        'cid',
      ),
    ),
  );
  return $schema;
}

/**
 * Implements hook_install();
 */
function views_calc_install() {
}

/**
 * Implements hook_uninstall().
 */
function views_calc_uninstall() {
  db_query("DROP TABLE {views_calc_fields}");
  variable_del('views_calc_operators');
}

/**
 * Implements hook_update_last_removed().
 */
function views_calc_last_removed() {
  return 2;
}

/**
 * Update views_calc_fields table to add a new base column.
 */
function views_calc_update_6000() {
  db_add_field('views_calc_fields', 'base', array(
    'type' => 'varchar',
    'length' => '255',
    'not null' => TRUE,
    'default' => 'node',
  ));
  return t("Added base to views_calc_fields table.");
}

Functions

Namesort descending Description
views_calc_install Implements hook_install();
views_calc_last_removed Implements hook_update_last_removed().
views_calc_schema Implements hook_schema().
views_calc_uninstall Implements hook_uninstall().
views_calc_update_6000 Update views_calc_fields table to add a new base column.