You are here

function file_entity_update_7200 in File Entity (fieldable files) 7.3

Same name and namespace in other branches
  1. 7.2 file_entity.install \file_entity_update_7200()

Create the {image_dimensions} database table.

File

./file_entity.install, line 401
Install, update and uninstall functions for the file_entity module.

Code

function file_entity_update_7200() {
  if (db_table_exists('image_dimensions')) {
    return t('The table {image_dimensions} already exists.');
  }
  $schema['image_dimensions'] = array(
    'description' => 'Cache images dimensions.',
    'fields' => array(
      'fid' => array(
        'description' => 'File ID.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'height' => array(
        'description' => 'The height of the image in pixels.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'width' => array(
        'description' => 'The width of the image in pixels..',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'fid',
    ),
    'foreign keys' => array(
      'file_managed' => array(
        'table' => 'file_managed',
        'columns' => array(
          'fid' => 'fid',
        ),
      ),
    ),
  );
  db_create_table('image_dimensions', $schema['image_dimensions']);
}