Issue #3388170 by DiDebru, tetranz, alexpott, smustgrave: system update 10100 cache tables fail
parent
20c05b5c71
commit
e8778fb265
|
@ -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.
|
||||
|
|
|
@ -95,6 +95,17 @@ class Y2038TimestampUpdateTest extends UpdatePathTestBase {
|
|||
$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
|
||||
|
@ -120,7 +131,7 @@ class Y2038TimestampUpdateTest extends UpdatePathTestBase {
|
|||
}
|
||||
$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…
Reference in New Issue