function db_add_unique_key

Same name in other branches
  1. 8.9.x core/includes/database.inc \db_add_unique_key()

Adds a unique key.

Parameters

$table: The table to be altered.

$name: The name of the key.

$fields: An array of field names.

Related topics

4 calls to db_add_unique_key()
BasicMinimalUpdatePath::testBasicMinimalUpdate in modules/simpletest/tests/upgrade/upgrade.test
Tests a successful point release update.
node_update_7013 in modules/node/node.install
Change {node}.vid default value from 0 to NULL to avoid deadlock issues on MySQL.
system_update_7073 in modules/system/system.install
Add binary to {file_managed}, in case system_update_7034() was run without it.
taxonomy_update_7002 in modules/taxonomy/taxonomy.install
Add {vocabulary}.machine_name column.

File

includes/database/database.inc, line 3050

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.