You are here

nodehierarchy_views.install in Node Hierarchy 7.4

Install file for nodehierarchy_views module.

File

nodehierarchy_views/nodehierarchy_views.install
View source
<?php

/**
 * @file
 *   Install file for nodehierarchy_views module.
 */

// Create the database table on install (MySQL only for now)

/**
 * Implements hook_install().
 */
function nodehierarchy_views_install() {
}

/**
 * Implements hook_uninstall().
 */
function nodehierarchy_views_uninstall() {
}

/**
 * Increased embedded view display id to 64 chars to match the length allowed in Views.
 */
function nodehierarchy_views_update_6200() {
  $ret = array();

  // Add more length to the field name to accomodate the
  db_add_field('nodehierarchy_views', 'nh_children_view_display', array(
    'type' => 'varchar',
    'length' => '64',
    'default' => 'default',
    'not null' => TRUE,
    'description' => t('The {views_display}.id of the embedded view.'),
  ));
  return t('View display name column updated to 128 chars in db table.');
}

/**
 * Implements hook_schema().
 */
function nodehierarchy_views_schema() {
  $schema['nodehierarchy_views'] = array(
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The {node}.nid whose children are being embedded.',
      ),
      'nh_children_view' => array(
        'type' => 'varchar',
        'length' => '128',
        'default' => '',
        'not null' => TRUE,
        'description' => 'The {views_view}.name of the embedded view.',
      ),
      'nh_children_view_display' => array(
        'type' => 'varchar',
        'length' => '64',
        'default' => 'default',
        'not null' => TRUE,
        'description' => 'The {views_display}.id of the embedded view.',
      ),
    ),
    'primary key' => array(
      'nid',
    ),
  );
  return $schema;
}

/**
 * Increase embedded view name to 128 chars to match new length allowed in Views.
 */
function nodehierarchy_views_update_7302() {
  db_change_field('nodehierarchy_views', 'nh_children_view', 'nh_children_view', array(
    'type' => 'varchar',
    'length' => '128',
    'default' => 'default',
    'not null' => TRUE,
    'description' => t('The {views_view}.name of the embedded view.'),
  ));
  return t('View name column updated to 128 chars in db table.');
}

Functions

Namesort descending Description
nodehierarchy_views_install Implements hook_install().
nodehierarchy_views_schema Implements hook_schema().
nodehierarchy_views_uninstall Implements hook_uninstall().
nodehierarchy_views_update_6200 Increased embedded view display id to 64 chars to match the length allowed in Views.
nodehierarchy_views_update_7302 Increase embedded view name to 128 chars to match new length allowed in Views.