protected function SqlContentEntityStorageSchema::addUniqueKey

protected SqlContentEntityStorageSchema::addUniqueKey($table, $name, array $specifier)

Creates a unique key, dropping it if already existing.

Parameters

string $table: The table name.

string $name: The index name.

array $specifier: The unique fields.

See also

\Drupal\Core\Database\Schema::addUniqueKey()

File

core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php, line 2016

Class

SqlContentEntityStorageSchema
Defines a schema handler that supports revisionable, translatable entities.

Namespace

Drupal\Core\Entity\Sql

Code

protected function addUniqueKey($table, $name, array $specifier) {
  $schema_handler = $this->database->schema();
  $schema_handler->dropUniqueKey($table, $name);
  $schema_handler->addUniqueKey($table, $name, $specifier);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!Sql!SqlContentEntityStorageSchema.php/function/SqlContentEntityStorageSchema::addUniqueKey/8.1.x