function Schema::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
\Drupal\Core\Database\SchemaObjectDoesNotExistException If the specified table doesn't exist.
\Drupal\Core\Database\SchemaObjectExistsException If the specified table already has a key by that name.
4 methods override Schema::addUniqueKey()
- Schema::addUniqueKey in core/
modules/ sqlite/ src/ Driver/ Database/ sqlite/ Schema.php - Add a unique key.
- Schema::addUniqueKey in core/
modules/ mysql/ src/ Driver/ Database/ mysql/ Schema.php - Add a unique key.
- Schema::addUniqueKey in core/
modules/ pgsql/ src/ Driver/ Database/ pgsql/ Schema.php - Add a unique key.
- Schema::addUniqueKey in core/
tests/ fixtures/ database_drivers/ module/ core_fake/ src/ Driver/ Database/ CoreFakeWithAllCustomClasses/ Schema.php - Add a unique key.
File
-
core/
lib/ Drupal/ Core/ Database/ Schema.php, line 418
Class
- Schema
- Provides a base implementation for Database Schema.
Namespace
Drupal\Core\DatabaseCode
abstract public function addUniqueKey($table, $name, $fields);
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.