function db_index_exists

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 calls to db_index_exists()
LanguageUpgradePathTest::testLanguageNoPluralsUpgrade in drupal/core/modules/system/lib/Drupal/system/Tests/Upgrade/LanguageUpgradePathTest.php
Tests upgrading translations without plurals.
RegressionTest::testDBIndexExists in drupal/core/modules/system/lib/Drupal/system/Tests/Database/RegressionTest.php
Tests the db_index_exists() function.

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);
}