function system_update_8403 in Drupal 8
Delete all cache_* tables. They are recreated on demand with the new schema.
File
- core/
modules/ system/ system.install, line 2440 - Install, update and uninstall functions for the system module.
Code
function system_update_8403() {
foreach (Cache::getBins() as $bin => $cache_backend) {
// Try to delete the table regardless of which cache backend is handling it.
// This is to ensure the new schema is used if the configuration for the
// backend class is changed after the update hook runs.
$table_name = "cache_{$bin}";
$schema = Database::getConnection()
->schema();
if ($schema
->tableExists($table_name)) {
$schema
->dropTable($table_name);
}
}
}