You are here

views_data_export.install in Views data export 6.3

File

views_data_export.install
View source
<?php

/**
 * Implementation of hook_schema()
 */
function views_data_export_schema() {
  $schema = array();
  $schema['views_data_export'] = array(
    'description' => t('Keep track of currently executing exports.'),
    'fields' => array(
      'eid' => array(
        'description' => 'Unique id for each on-going export.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'view_name' => array(
        'type' => 'varchar',
        'length' => '32',
        'default' => '',
        'not null' => TRUE,
        'description' => 'The unique name of the view. This is the primary field views are loaded from, and is used so that views may be internal and not necessarily in the database. May only be alphanumeric characters plus underscores.',
      ),
      'view_display_id' => array(
        'type' => 'varchar',
        'length' => '32',
        'default' => '',
        'not null' => TRUE,
        'description' => 'The unique name of the view. This is the primary field views are loaded from, and is used so that views may be internal and not necessarily in the database. May only be alphanumeric characters plus underscores.',
      ),
      'time_stamp' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The time this export started',
      ),
      'fid' => array(
        'description' => 'Files ID.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'batch_state' => array(
        'type' => 'varchar',
        'length' => '32',
        'default' => 'init',
        'not null' => TRUE,
        'description' => 'The current state of the batch.',
      ),
      'sandbox' => array(
        'type' => 'text',
        'not null' => TRUE,
        'serialize' => TRUE,
      ),
    ),
    'primary key' => array(
      'eid',
    ),
  );
  $schema['views_data_export_object_cache'] = array(
    'description' => 'A modified version of the views_object_cache that ignores session id.',
    'fields' => array(
      'eid' => array(
        'type' => 'varchar',
        'length' => '64',
        'description' => 'The export ID this view equates too.',
      ),
      'updated' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The time this cache was created or updated.',
      ),
      'data' => array(
        'type' => 'text',
        'size' => 'big',
        'description' => 'Serialized data being stored.',
        'serialize' => TRUE,
      ),
    ),
    'indexes' => array(
      'eid' => array(
        'eid',
      ),
      'updated' => array(
        'updated',
      ),
    ),
  );
  return $schema;
}

/**
 * Implementation of hook_install()
 */
function views_data_export_install() {
  drupal_install_schema('views_data_export');
}

/**
 * Implementation of hook_uninstall()
 */
function views_data_export_uninstall() {

  //Clean up any tables we may have left around
  views_data_export_garbage_collect(0, -1);

  //Remove our base table
  drupal_uninstall_schema('views_data_export');
}

/**
 * Convert the data column in the object cache.
 */
function views_data_export_update_6200() {
  $ret = array();
  $new_field = array(
    'type' => 'text',
    'size' => 'big',
    'description' => 'Serialized data being stored.',
    'serialize' => TRUE,
  );

  // Drop and re-add this field because there is a bug in
  // db_change_field that causes this to fail when trying to cast the data.
  db_drop_field($ret, 'views_data_export_object_cache', 'data');
  db_add_field($ret, 'views_data_export_object_cache', 'data', $new_field);
  return $ret;
}

Functions

Namesort descending Description
views_data_export_install Implementation of hook_install()
views_data_export_schema Implementation of hook_schema()
views_data_export_uninstall Implementation of hook_uninstall()
views_data_export_update_6200 Convert the data column in the object cache.