function db_index_exists

8.x database.inc db_index_exists($table, $name)

Checks if an index exists in the given table.

Parameters

$table: The name of the table in drupal (no prefixing).

$name: The name of the index in drupal (no prefixing).

Return value

TRUE if the given index exists, otherwise FALSE.

Related topics

File

drupal/core/includes/database.inc, line 620
Core systems for the database layer.

Code

function db_index_exists($table, $name) {
  return Database::getConnection()->schema()->indexExists($table, $name);
}