function db_add_index

Adds an index.

Parameters

$table: The table to be altered.

$name: The name of the index.

$fields: An array of field names.

Related topics

5 calls to db_add_index()
comment_update_8000 in drupal/core/modules/comment/comment.install
Renames {comment}.language to {comment}.langcode.
field_sql_storage_field_storage_update_field in drupal/core/modules/field_sql_storage/field_sql_storage.module
Implements hook_field_storage_update_field().
field_sql_storage_update_8000 in drupal/core/modules/field_sql_storage/field_sql_storage.install
Renames the 'language' column to 'langcode' in field data tables.
SchemaTest::testSchema in drupal/core/modules/system/lib/Drupal/system/Tests/Database/SchemaTest.php
Tests database interactions.
taxonomy_update_8006 in drupal/core/modules/taxonomy/taxonomy.install
Change {taxonomy_term_data}.vid into a string holding the vocabulary machine name.

File

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

Code

function db_add_index($table, $name, $fields) {
  return Database::getConnection()
    ->schema()
    ->addIndex($table, $name, $fields);
}