diff --git a/core/lib/Drupal/Core/Command/DbDumpCommand.php b/core/lib/Drupal/Core/Command/DbDumpCommand.php index cfaa460..d71bb37 100644 --- a/core/lib/Drupal/Core/Command/DbDumpCommand.php +++ b/core/lib/Drupal/Core/Command/DbDumpCommand.php @@ -210,6 +210,11 @@ protected function getTableSchema($table) { if (isset($row['Collation']) && $row['Collation'] == 'ascii_general_ci') { $definition['fields'][$name]['type'] = 'varchar_ascii'; } + + // Check for the 'utf8_bin' collation. + if (isset($row['Collation']) && $row['Collation'] == 'utf8_bin') { + $definition['fields'][$name]['binary'] = TRUE; + } } // Set primary key, unique keys, and indexes. @@ -314,9 +319,10 @@ protected function fieldSizeMap($type) { $map = array_map('strtolower', $this->connection->schema()->getFieldTypeMap()); $map = array_flip($map); - // The MySql map contains type:size. Remove the type part. $schema_type = explode(':', $map[$type])[0]; - if (in_array($schema_type, ['blob', 'int', 'text'])) { + // Only specify size on these types. + if (in_array($schema_type, ['blob', 'float', 'int', 'text'])) { + // The MySql map contains type:size. Remove the type part. return explode(':', $map[$type])[1]; } } diff --git a/core/modules/system/src/Tests/Update/DbDumpTest.php b/core/modules/system/src/Tests/Update/DbDumpTest.php index b857bdd..eed79cd 100644 --- a/core/modules/system/src/Tests/Update/DbDumpTest.php +++ b/core/modules/system/src/Tests/Update/DbDumpTest.php @@ -26,7 +26,7 @@ class DbDumpTest extends KernelTestBase { /** * {@inheritdoc} */ - public static $modules = ['system', 'config', 'dblog', 'menu_link_content', 'link', 'block_content']; + public static $modules = ['system', 'config', 'dblog', 'menu_link_content', 'link', 'block_content', 'file', 'user']; /** * Test data to write into config. @@ -88,12 +88,15 @@ public function setUp() { // Create some schemas so our export contains tables. $this->installSchema('system', [ + 'key_value_expire', + 'semaphore', 'sessions', 'url_alias', - 'key_value_expire', ]); $this->installSchema('dblog', ['watchdog']); $this->installEntitySchema('block_content'); + $this->installEntitySchema('user'); + $this->installEntitySchema('file'); $this->installEntitySchema('menu_link_content'); // Place some sample config to test for in the export. @@ -118,11 +121,16 @@ public function setUp() { 'cache_discovery', 'cache_bootstrap', 'cache_default', + 'file_managed', 'key_value_expire', 'menu_link_content', 'menu_link_content_data', + 'semaphore', 'sessions', 'url_alias', + 'user__roles', + 'users', + 'users_field_data', 'watchdog', ]; }