db_index_exists

  1. drupal
    1. 8
    2. 7
Versions
7 – 8 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

▾ 2 functions call db_index_exists()

DatabaseRegressionTestCase::testDBIndexExists in modules/simpletest/tests/database_test.test
Test the db_index_exists() function.
locale_update_7000 in modules/locale/locale.install
Add context field index and allow longer location.

Code

includes/database/database.inc, line 2716

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