function SqlContentEntityStorageSchema::addUniqueKey
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::addUniqueKey()
- 8.9.x core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::addUniqueKey()
- 11.x core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::addUniqueKey()
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 2537
Class
- SqlContentEntityStorageSchema
- Defines a schema handler that supports revisionable, translatable entities.
Namespace
Drupal\Core\Entity\SqlCode
protected function addUniqueKey($table, $name, array $specifier) {
$schema_handler = $this->database
->schema();
$schema_handler->dropUniqueKey($table, $name);
$schema_handler->addUniqueKey($table, $name, $specifier);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.