You are here

function file_entity_update_7215 in File Entity (fieldable files) 7.3

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

Fix the {file_metadata}.fid schema.

File

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

Code

function file_entity_update_7215() {

  // When changing a primary key serial field to an int, we need to add a
  // temporary index to make this update work.
  // @see https://drupal.org/node/190027
  db_add_index('file_metadata', 'temp', array(
    'fid',
  ));
  db_drop_primary_key('file_metadata');
  db_change_field('file_metadata', 'fid', 'fid', array(
    'description' => 'The {file_managed}.fid of the metadata.',
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 0,
  ));
  db_add_primary_key('file_metadata', array(
    'fid',
    'name',
  ));
  db_drop_index('file_metadata', 'temp');
}