function Schema::validateUniqueKeySchema

Validates a unique key schema definition.

Parameters

KeyColumns $key_fields: An array containing the fields that will form the unique key.

Throws

\Drupal\Core\Database\SchemaException If the specified key fails validation.

12 calls to Schema::validateUniqueKeySchema()
Schema::addField in core/modules/sqlite/src/Driver/Database/sqlite/Schema.php
Add a new field to a table.
Schema::addField in core/modules/mysql/src/Driver/Database/mysql/Schema.php
Add a new field to a table.
Schema::addField in core/modules/pgsql/src/Driver/Database/pgsql/Schema.php
Add a new field to a table.
Schema::addUniqueKey in core/modules/pgsql/src/Driver/Database/pgsql/Schema.php
Add a unique key.
Schema::addUniqueKey in core/modules/mysql/src/Driver/Database/mysql/Schema.php
Add a unique key.

... See full list

File

core/lib/Drupal/Core/Database/Schema.php, line 513

Class

Schema
Provides a base implementation for Database Schema.

Namespace

Drupal\Core\Database

Code

protected function validateUniqueKeySchema(array $key_fields) : void {
  foreach ($key_fields as $key_field) {
    if (is_array($key_field)) {
      @trigger_error('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', E_USER_DEPRECATED);
    }
  }
}

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