You are here

panels_content_cache.install in Panels Content Cache 6

Same filename and directory in other branches
  1. 7 panels_content_cache.install

File

panels_content_cache.install
View source
<?php

/**
 * Implements hook_schema().
 */
function panels_content_cache_schema() {
  $schema = array();
  $schema['panels_content_cache'] = array(
    'description' => 'Stores display IDs and content types for content cached panel displays.',
    'fields' => array(
      'did' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'pid' => array(
        'type' => 'int',
        'default' => NULL,
      ),
      'type' => array(
        'description' => 'The {node_type}.type.',
        'type' => 'varchar',
        'length' => 32,
        'default' => NULL,
      ),
      'menu_name' => array(
        'description' => 'The menu name if selected.',
        'type' => 'varchar',
        'length' => 32,
        'default' => NULL,
      ),
    ),
    'indexes' => array(
      'did' => array(
        'did',
      ),
      'pid' => array(
        'pid',
      ),
    ),
  );
  return $schema;
}

/**
 * Implements hook_install().
 */
function panels_content_cache_install() {
  drupal_install_schema('panels_content_cache');
}

/**
 * Update 6001 - Add new field menu_name and change type field schema.
 */
function panels_content_cache_update_6001() {
  $ret = array();

  // Add in menu_name column.
  db_add_field($ret, 'panels_content_cache', 'menu_name', array(
    'description' => 'The menu name if selected.',
    'type' => 'varchar',
    'length' => 32,
    'default' => NULL,
  ));

  // Change type field to allow default NULL value.
  db_change_field($ret, 'panels_content_cache', 'type', 'type', array(
    'description' => 'The {node_type}.type.',
    'type' => 'varchar',
    'length' => 32,
    'default' => NULL,
  ));
  return $ret;
}

/**
 * Implements hook_uninstall().
 */
function panels_content_cache_uninstall() {
  drupal_uninstall_schema('panels_content_cache');
}

Functions

Namesort descending Description
panels_content_cache_install Implements hook_install().
panels_content_cache_schema Implements hook_schema().
panels_content_cache_uninstall Implements hook_uninstall().
panels_content_cache_update_6001 Update 6001 - Add new field menu_name and change type field schema.