Loading core/modules/system/system.install +6 −0 Original line number Diff line number Diff line Loading @@ -1823,6 +1823,12 @@ function system_update_10100(&$sandbox = NULL) { }); if ($connection->databaseType() != 'sqlite') { foreach (array_keys($cache_tables) as $table) { // If the table has no expire column there is nothing to do. This can // happen if a site has tables starting with cache_ that are not cache // bins. if (!$schema->fieldExists($table, 'expire')) { continue; } // Truncate cache tables. They will be flushed anyway at the end of // database updates, but emptying the tables now will boost the schema // changes. Loading core/modules/system/tests/src/Functional/Update/Y2038TimestampUpdateTest.php +12 −1 Original line number Diff line number Diff line Loading @@ -95,6 +95,17 @@ public function testUpdate() { $this->markTestSkipped("This test does not support the SQLite database driver."); } // Create a table starting with cache that is not a cache bin. \Drupal::service('database')->schema()->createTable('cache_bogus', [ 'fields' => [ 'id' => [ 'type' => 'int', 'not null' => TRUE, ], ], 'primary key' => ['id'], ]); $this->collectTimestampFieldsFromDatabase(); // PostgreSQL returns the value 'integer' instead of 'int' when queried // about the column type. Some PostgreSQL tables are already of the type Loading @@ -120,7 +131,7 @@ public function collectTimestampFieldsFromDatabase() { } $tables = $connection->schema()->findTables('cache_%'); $tables = array_filter($tables, function ($table) { return str_starts_with($table, 'cache_'); return str_starts_with($table, 'cache_') && $table !== 'cache_bogus'; }); $this->assertNotEmpty($tables); foreach ($tables as $table) { Loading Loading
core/modules/system/system.install +6 −0 Original line number Diff line number Diff line Loading @@ -1823,6 +1823,12 @@ function system_update_10100(&$sandbox = NULL) { }); if ($connection->databaseType() != 'sqlite') { foreach (array_keys($cache_tables) as $table) { // If the table has no expire column there is nothing to do. This can // happen if a site has tables starting with cache_ that are not cache // bins. if (!$schema->fieldExists($table, 'expire')) { continue; } // Truncate cache tables. They will be flushed anyway at the end of // database updates, but emptying the tables now will boost the schema // changes. Loading
core/modules/system/tests/src/Functional/Update/Y2038TimestampUpdateTest.php +12 −1 Original line number Diff line number Diff line Loading @@ -95,6 +95,17 @@ public function testUpdate() { $this->markTestSkipped("This test does not support the SQLite database driver."); } // Create a table starting with cache that is not a cache bin. \Drupal::service('database')->schema()->createTable('cache_bogus', [ 'fields' => [ 'id' => [ 'type' => 'int', 'not null' => TRUE, ], ], 'primary key' => ['id'], ]); $this->collectTimestampFieldsFromDatabase(); // PostgreSQL returns the value 'integer' instead of 'int' when queried // about the column type. Some PostgreSQL tables are already of the type Loading @@ -120,7 +131,7 @@ public function collectTimestampFieldsFromDatabase() { } $tables = $connection->schema()->findTables('cache_%'); $tables = array_filter($tables, function ($table) { return str_starts_with($table, 'cache_'); return str_starts_with($table, 'cache_') && $table !== 'cache_bogus'; }); $this->assertNotEmpty($tables); foreach ($tables as $table) { Loading