function DatabaseSchema::addUniqueKey

Add a unique key.

Parameters

$table: The table to be altered.

$name: The name of the key.

$fields: An array of field names.

Throws

DatabaseSchemaObjectDoesNotExistException If the specified table doesn't exist.

DatabaseSchemaObjectExistsException If the specified table already has a key by that name.

3 methods override DatabaseSchema::addUniqueKey()
DatabaseSchema_mysql::addUniqueKey in includes/database/mysql/schema.inc
Add a unique key.
DatabaseSchema_pgsql::addUniqueKey in includes/database/pgsql/schema.inc
Add a unique key.
DatabaseSchema_sqlite::addUniqueKey in includes/database/sqlite/schema.inc
Add a unique key.

File

includes/database/schema.inc, line 604

Class

DatabaseSchema
Base class for database schema definitions.

Code

public abstract function addUniqueKey($table, $name, $fields);

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