You are here

function taxonomy_image_update_6100 in Taxonomy Image 6

Implementation of hook_update_N(). Add a cache table.

File

./taxonomy_image.install, line 115
taxonomy_image.install. Simple module for providing an association between taxonomy terms and images. Written by Jeremy Andrews <jeremy@kerneltrap.org>, May 2004.

Code

function taxonomy_image_update_6100() {
  $ret = array();

  // Upgrading from 5.x?
  if (db_table_exists('cache_tax_image')) {
    if (!db_column_exists('cache_tax_image', 'serialized')) {
      db_add_column($ret, 'cache_tax_image', 'serialized', 'smallint', array(
        'not null' => TRUE,
        'default' => 0,
      ));
    }
  }
  else {
    $schema['cache_tax_image'] = array(
      'module' => 'Taxonomy Image',
      'fields' => array(
        'cid' => array(
          'description' => t('Primary Key: Unique cache ID.'),
          'type' => 'varchar',
          'length' => 255,
          'not null' => TRUE,
          'default' => '',
        ),
        'data' => array(
          'description' => t('A collection of data to cache.'),
          'type' => 'blob',
          'not null' => FALSE,
          'size' => 'big',
        ),
        'expire' => array(
          'description' => t('A Unix timestamp indicating when the cache entry should expire, or 0 for never.'),
          'type' => 'int',
          'not null' => TRUE,
          'default' => 0,
        ),
        'created' => array(
          'description' => t('A Unix timestamp indicating when the cache entry was created.'),
          'type' => 'int',
          'not null' => TRUE,
          'default' => 0,
        ),
        'headers' => array(
          'description' => t('Any custom HTTP headers to be added to cached data.'),
          'type' => 'text',
          'not null' => FALSE,
        ),
        'serialized' => array(
          'description' => t('A flag to indicate whether content is serialized (1) or not (0).'),
          'type' => 'int',
          'size' => 'small',
          'not null' => TRUE,
          'default' => 0,
        ),
      ),
      'indexes' => array(
        'expire' => array(
          'expire',
        ),
      ),
      'primary key' => array(
        'cid',
      ),
    );
    db_create_table($ret, 'cache_tax_image', $schema['cache_tax_image']);
  }
  return $ret;
}