$keys =
[];
if (!
empty($spec['primary key'
])) { $keys[] = 'PRIMARY KEY (' .
$this->
createKeySql($spec['primary key'
]) . ')';
} if (!
empty($spec['unique keys'
])) { foreach ($spec['unique keys'
] as $key =>
$fields) { $keys[] = 'UNIQUE KEY [' .
$key . '] (' .
$this->
createKeySql($fields) . ')';
} } if (!
empty($spec['indexes'
])) { $indexes =
$this->
getNormalizedIndexes($spec);
foreach ($indexes as $index =>
$fields) { $keys[] = 'INDEX [' .
$index . '] (' .
$this->
createKeySql($fields) . ')';
} } return $keys;
} /**
* Gets normalized indexes from a table specification.
*
* Shortens indexes to 191 characters if they apply to utf8mb4-encoded
* fields, in order to comply with the InnoDB index limitation of 756 bytes.
*
* @param array $spec
* The table specification.
*
* @return array
* List of shortened indexes.
*
* @throws \Drupal\Core\Database\SchemaException
* Thrown if field specification is missing.
*/