diff --git a/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php b/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
index 8f5b710..e5a44f4 100644
--- a/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
+++ b/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
@@ -306,40 +306,55 @@ protected function createKeysSql($spec) {
    *   List of shortened indexes.
    */
   protected function getNormalizedIndexes($spec) {
-    $indexes = $spec['indexes'];
-    foreach ($indexes as $index_name => $index_fields) {
-      foreach ($index_fields as $index_key => $index_field) {
-        // Get the name of the field from the index specification.
-        $field_name = is_array($index_field) ? $index_field[0] : $index_field;
-        // Check whether the field is defined in the table specification.
-        if (isset($spec['fields'][$field_name])) {
-          // Get the MySQL type from the processed field.
-          $mysql_field = $this->processField($spec['fields'][$field_name]);
-          if (in_array($mysql_field['mysql_type'], $this->mysqlStringTypes)) {
-            // Check whether we need to shorten the index.
-            if ((!isset($mysql_field['type']) || $mysql_field['type'] != 'varchar_ascii') && (!isset($mysql_field['length']) || $mysql_field['length'] > 191)) {
-              // Limit the index length to 191 characters.
-              $this->shortenIndex($indexes[$index_name][$index_key]);
-            }
+    $indexes = [];
+    foreach ($spec['indexes'] as $index_name => $index_fields) {
+      $indexes[$index_name] = $this->getNormalizedIndex($index_fields);
+    }
+    return $indexes;
+  }
+
+  /**
+   * Normalize a single index.
+   *
+   * @param $index_fields
+   *   A index specification.
+   *
+   * @return array
+   *   An index normalized to shortened indexes.
+   */
+  protected function getNormalizedIndex($index_fields) {
+    foreach ($index_fields as $index_key => $index_field) {
+      // Get the name of the field from the index specification.
+      $field_name = is_array($index_field) ? $index_field[0] : $index_field;
+      // Check whether the field is defined in the table specification.
+      if (isset($spec['fields'][$field_name])) {
+        // Get the MySQL type from the processed field.
+        $mysql_field = $this->processField($spec['fields'][$field_name]);
+        if (in_array($mysql_field['mysql_type'], $this->mysqlStringTypes)) {
+          // Check whether we need to shorten the index.
+          if ((!isset($mysql_field['type']) || $mysql_field['type'] != 'varchar_ascii') && (!isset($mysql_field['length']) || $mysql_field['length'] > 191)) {
+            // Limit the index length to 191 characters.
+            return $this->shortenIndex($index_fields[$index_key]);
           }
         }
       }
     }
-    return $indexes;
   }
 
   /**
-   * Helper function for normalizeIndexes().
+   * Helper function for normalizeIndex().
    *
-   * Shortens an index to 191 characters.
    *
    * @param array $index
    *   The index array to be used in createKeySql.
    *
+   * @return array
+   *   And index with length limited to 191 characters.
+   *
    * @see Drupal\Core\Database\Driver\mysql\Schema::createKeySql()
-   * @see Drupal\Core\Database\Driver\mysql\Schema::normalizeIndexes()
+   * @see Drupal\Core\Database\Driver\mysql\Schema::normalizeIndex()
    */
-  protected function shortenIndex(&$index) {
+  protected function shortenIndex($index) {
     if (is_array($index)) {
       if ($index[1] > 191) {
         $index[1] = 191;
@@ -348,6 +363,7 @@ protected function shortenIndex(&$index) {
     else {
       $index = array($index, 191);
     }
+    return $index;
   }
 
   protected function createKeySql($fields) {
@@ -494,7 +510,7 @@ public function addIndex($table, $name, $fields) {
       throw new SchemaObjectExistsException(t("Cannot add index @name to table @table: index already exists.", array('@table' => $table, '@name' => $name)));
     }
 
-    $this->connection->query('ALTER TABLE {' . $table . '} ADD INDEX `' . $name . '` (' . $this->createKeySql($fields) . ')');
+    $this->connection->query('ALTER TABLE {' . $table . '} ADD INDEX `' . $name . '` (' . $this->createKeySql($this->getNormalizedIndex($fields)) . ')');
   }
 
   public function dropIndex($table, $name) {
