You are here

function file_entity_update_7101 in D7 Media 7

Create the {image_dimensions} database table.

File

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

Code

function file_entity_update_7101() {
  if (!db_table_exists('image_dimensions')) {
    $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']);
  }
}