You are here

protected function Schema::shortenIndex in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Database/Driver/mysql/Schema.php \Drupal\Core\Database\Driver\mysql\Schema::shortenIndex()

Helper function for normalizeIndexes().

Shortens an index to 191 characters.

Parameters

array $index: The index array to be used in createKeySql.

See also

Drupal\Core\Database\Driver\mysql\Schema::createKeySql()

Drupal\Core\Database\Driver\mysql\Schema::normalizeIndexes()

1 call to Schema::shortenIndex()
Schema::getNormalizedIndexes in core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
Gets normalized indexes from a table specification.

File

core/lib/Drupal/Core/Database/Driver/mysql/Schema.php, line 355

Class

Schema
MySQL implementation of \Drupal\Core\Database\Schema.

Namespace

Drupal\Core\Database\Driver\mysql

Code

protected function shortenIndex(&$index) {
  if (is_array($index)) {
    if ($index[1] > 191) {
      $index[1] = 191;
    }
  }
  else {
    $index = [
      $index,
      191,
    ];
  }
}