You are here

function file_entity_update_7205 in File Entity (fieldable files) 7.3

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

Fix broken indexes caused by incorrect index definitions in update 7201.

File

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

Code

function file_entity_update_7205() {

  // Drop broken file type indexes. These may not exist if the broken version
  // of update 7201 was never run.
  if (db_index_exists('file_type_mimetypes', 0)) {
    db_drop_index('file_type_mimetypes', 0);
  }
  if (db_index_exists('file_type_mimetypes', 1)) {
    db_drop_index('file_type_mimetypes', 1);
  }

  // Add file type indexes. These may already exist if the fixed version of
  // update 7201 was run.
  if (!db_index_exists('file_type_mimetypes', 'file_type')) {
    db_add_index('file_type_mimetypes', 'file_type', array(
      'type',
    ));
  }
  if (!db_index_exists('file_type_mimetypes', 'file_type_mimetype')) {
    db_add_index('file_type_mimetypes', 'file_type_mimetype', array(
      'mimetype',
    ));
  }
}