function SchemaUniquePrefixedKeysIndexTestBase::testAddUniqueKey
Same name and namespace in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Database/SchemaUniquePrefixedKeysIndexTestBase.php \Drupal\KernelTests\Core\Database\SchemaUniquePrefixedKeysIndexTestBase::testAddUniqueKey()
- 10 core/tests/Drupal/KernelTests/Core/Database/SchemaUniquePrefixedKeysIndexTestBase.php \Drupal\KernelTests\Core\Database\SchemaUniquePrefixedKeysIndexTestBase::testAddUniqueKey()
Tests adding a UNIQUE key to an existing table.
Attributes
#[IgnoreDeprecations]
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Database/ SchemaUniquePrefixedKeysIndexTestBase.php, line 57
Class
- SchemaUniquePrefixedKeysIndexTestBase
- Tests adding UNIQUE keys to tables.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testAddUniqueKey() : void {
$this->expectUserDeprecationMessage('Specification of unique keys with column length is deprecated in drupal:12.1.0 and will throw a SchemaException from drupal:13.0.0. Specify full columns for an unique key, or use an index for columns with partial length. See https://www.drupal.org/node/3375071');
$this->connection
->schema()
->addUniqueKey('test_people', 'job', [
[
'job',
10,
],
]);
$this->checkUniqueConstraintException('test_people', 'job');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.