You are here

function file_entity_update_7211 in File Entity (fieldable files) 7.3

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

Create the {file_metadata} table.

File

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

Code

function file_entity_update_7211() {
  $schema = array(
    'description' => 'Stores file metadata in a key/value store.',
    'fields' => array(
      'fid' => array(
        'description' => 'The {file_managed}.fid of the metadata.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'name' => array(
        'description' => "The name of the metadata (e.g. 'width').",
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
      ),
      'value' => array(
        'description' => "The value of the metadata (e.g. '200px').",
        'type' => 'blob',
        'not null' => FALSE,
        'size' => 'big',
        'serialize' => TRUE,
      ),
    ),
    'primary key' => array(
      'fid',
      'name',
    ),
    'foreign keys' => array(
      'file_managed' => array(
        'table' => 'file_managed',
        'columns' => array(
          'fid' => 'fid',
        ),
      ),
    ),
  );
  db_create_table('file_metadata', $schema);
}