Loading core/lib/Drupal/Core/Command/DbDumpCommand.php +6 −1 Original line number Diff line number Diff line Loading @@ -334,7 +334,7 @@ protected function fieldTypeMap(Connection $connection, $type) { * @param string $type * The MySQL field type. * * @return string * @return string|null * The Drupal schema field size. */ protected function fieldSizeMap(Connection $connection, $type) { Loading @@ -342,6 +342,11 @@ protected function fieldSizeMap(Connection $connection, $type) { $map = array_map('strtolower', $connection->schema()->getFieldTypeMap()); $map = array_flip($map); // Do nothing if the field type is not defined. if (!isset($map[$type])) { return NULL; } $schema_type = explode(':', $map[$type])[0]; // Only specify size on these types. if (in_array($schema_type, ['blob', 'float', 'int', 'text'])) { Loading core/modules/system/tests/src/Kernel/Scripts/DbDumpCommandTest.php +6 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,12 @@ protected function setUp(): void { /** @var \Drupal\Core\Database\Connection $connection */ $connection = $this->container->get('database'); $connection->insert('router')->fields(['name', 'path', 'pattern_outline'])->values(['test', 'test', 'test'])->execute(); // Create a table with a field type not defined in // \Drupal\Core\Database\Schema::getFieldTypeMap. $table_name = $connection->tablePrefix() . 'foo'; $sql = "create table if not exists `$table_name` (`test` datetime NOT NULL);"; $connection->query($sql)->execute(); } /** Loading Loading
core/lib/Drupal/Core/Command/DbDumpCommand.php +6 −1 Original line number Diff line number Diff line Loading @@ -334,7 +334,7 @@ protected function fieldTypeMap(Connection $connection, $type) { * @param string $type * The MySQL field type. * * @return string * @return string|null * The Drupal schema field size. */ protected function fieldSizeMap(Connection $connection, $type) { Loading @@ -342,6 +342,11 @@ protected function fieldSizeMap(Connection $connection, $type) { $map = array_map('strtolower', $connection->schema()->getFieldTypeMap()); $map = array_flip($map); // Do nothing if the field type is not defined. if (!isset($map[$type])) { return NULL; } $schema_type = explode(':', $map[$type])[0]; // Only specify size on these types. if (in_array($schema_type, ['blob', 'float', 'int', 'text'])) { Loading
core/modules/system/tests/src/Kernel/Scripts/DbDumpCommandTest.php +6 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,12 @@ protected function setUp(): void { /** @var \Drupal\Core\Database\Connection $connection */ $connection = $this->container->get('database'); $connection->insert('router')->fields(['name', 'path', 'pattern_outline'])->values(['test', 'test', 'test'])->execute(); // Create a table with a field type not defined in // \Drupal\Core\Database\Schema::getFieldTypeMap. $table_name = $connection->tablePrefix() . 'foo'; $sql = "create table if not exists `$table_name` (`test` datetime NOT NULL);"; $connection->query($sql)->execute(); } /** Loading