diff --git a/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php b/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php index ea26c10..3ba7356 100644 --- a/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php +++ b/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php @@ -9,6 +9,7 @@ use Drupal\Core\Database\Database; use Drupal\Core\Database\Query\Condition; +use Drupal\Core\Database\SchemaIndexNotInSpecException; use Drupal\Core\Database\SchemaObjectExistsException; use Drupal\Core\Database\SchemaObjectDoesNotExistException; use Drupal\Core\Database\Schema as DatabaseSchema; diff --git a/core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php b/core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php index 301466c..4b6d131 100644 --- a/core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php +++ b/core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php @@ -8,6 +8,7 @@ namespace Drupal\Core\Database\Driver\sqlite; use Drupal\Component\Utility\Unicode; +use Drupal\Core\Database\SchemaIndexNotInSpecException; use Drupal\Core\Database\SchemaObjectExistsException; use Drupal\Core\Database\SchemaObjectDoesNotExistException; use Drupal\Core\Database\Schema as DatabaseSchema; diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php index 6f433f8..60eb9fe 100644 --- a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php @@ -1140,7 +1140,7 @@ protected function createSharedTableSchema(FieldStorageDefinitionInterface $stor // Check if the index exists because it might already have been // created as part of the earlier entity type update event. if (!$schema_handler->indexExists($table_name, $name)) { - $schema_handler->addNormalizedIndex($table_name, $name, $schema); + $schema_handler->addNormalizedIndex($table_name, $name, $schema[$table_name]); } } } @@ -1383,7 +1383,7 @@ protected function updateSharedTableSchema(FieldStorageDefinitionInterface $stor // Create new indexes and unique keys. if (!empty($schema[$table_name]['indexes'])) { foreach ($schema[$table_name]['indexes'] as $name => $specifier) { - $schema_handler->addNormalizedIndex($table_name, $name, $schema); + $schema_handler->addNormalizedIndex($table_name, $name, $schema[$table_name]); } } if (!empty($schema[$table_name]['unique keys'])) { diff --git a/core/modules/system/src/Tests/Database/SchemaTest.php b/core/modules/system/src/Tests/Database/SchemaTest.php index 910d44c..1bd2b06 100644 --- a/core/modules/system/src/Tests/Database/SchemaTest.php +++ b/core/modules/system/src/Tests/Database/SchemaTest.php @@ -297,7 +297,7 @@ function testIndexLength() { // Add a separate index. $table_specification_new = $table_specification; - $table_specification_new['indexes']['test_separate'] = array('test_field_text', 200); + $table_specification_new['indexes']['test_separate'] = [['test_field_text', 200]]; Database::getConnection()->schema()->addNormalizedIndex('test_table_index_length', 'test_separate', $table_specification_new); // Get index information. @@ -328,7 +328,7 @@ function testIndexLength() { // Count the number of columns defined in the indexes. $column_count = 0; - foreach ($table_specification['indexes'] as $index) { + foreach ($table_specification_new['indexes'] as $index) { foreach ($index as $field) { $column_count++; }