function db_drop_index
Same name in other branches
- 7.x includes/database/database.inc \db_drop_index()
Drops an index.
Parameters
$table: The table to be altered.
$name: The name of the index.
Return value
bool TRUE if the index was successfully dropped, FALSE if there was no index by that name to begin with.
Deprecated
in drupal:8.0.0 and is removed from drupal:9.0.0. Instead, get a database connection injected into your service from the container, get its schema driver, and call dropIndex() on it. For example, $injected_database->schema()->dropIndex($table, $name);
See also
https://www.drupal.org/node/2993033
\Drupal\Core\Database\Schema::dropIndex()
Related topics
1 call to db_drop_index()
- DatabaseLegacyTest::testDbDropIndex in core/
tests/ Drupal/ KernelTests/ Core/ Database/ DatabaseLegacyTest.php - Tests deprecation of the db_drop_index() function.
File
-
core/
includes/ database.inc, line 1043
Code
function db_drop_index($table, $name) {
@trigger_error('db_drop_index() is deprecated in drupal:8.0.0. It will be removed from drupal:9.0.0. Instead, get a database connection injected into your service from the container, get its schema driver, and call dropIndex() on it. For example, $injected_database->schema()->dropIndex($table, $name). See https://www.drupal.org/node/2993033', E_USER_DEPRECATED);
return Database::getConnection()->schema()
->dropIndex($table, $name);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.