You are here

function db_add_index in Drupal 7

Same name and namespace in other branches
  1. 8 core/includes/database.inc \db_add_index()
  2. 6 includes/database.mysql-common.inc \db_add_index()
  3. 6 includes/database.pgsql.inc \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

33 calls to db_add_index()
aggregator_update_7002 in modules/aggregator/aggregator.install
Add queued timestamp.
aggregator_update_7003 in modules/aggregator/aggregator.install
Increase the length of {aggregator_feed}.url.
aggregator_update_7004 in modules/aggregator/aggregator.install
Add index on timestamp.
comment_update_7002 in modules/comment/comment.install
Rename {comments} table to {comment} and upgrade it.
comment_update_7003 in modules/comment/comment.install
Split {comment}.timestamp into 'created' and 'changed', improve indexing on {comment}.

... See full list

File

includes/database/database.inc, line 3066
Core systems for the database layer.

Code

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