function db_add_unique_key

7.x db_add_unique_key($table, $name, $fields)
6.x db_add_unique_key(&$ret, $table, $name, $fields)
6.x db_add_unique_key(&$ret, $table, $name, $fields)
8.x db_add_unique_key($table, $name, $fields)

Adds a unique key.


$table: The table to be altered.

$name: The name of the key.

$fields: An array of field names.

Related topics

3 calls to db_add_unique_key()
node_update_7013 in drupal/modules/node/node.install
Change {node}.vid default value from 0 to NULL to avoid deadlock issues on MySQL.
system_update_7073 in drupal/modules/system/system.install
Add binary to {file_managed}, in case system_update_7034() was run without it.
taxonomy_update_7002 in drupal/modules/taxonomy/taxonomy.install
Add {vocabulary}.machine_name column.


drupal/includes/database/, line 2950
Core systems for the database layer.


function db_add_unique_key($table, $name, $fields) {
  return Database::getConnection()->schema()->addUniqueKey($table, $name, $fields);