diff -u b/core/modules/history/history.install b/core/modules/history/history.install --- b/core/modules/history/history.install +++ b/core/modules/history/history.install @@ -25,7 +25,7 @@ 'description' => 'The type of the entity that was read.', 'type' => 'varchar_ascii', 'not null' => TRUE, - 'default' => 'node', + 'default' => '', 'length' => EntityTypeInterface::ID_MAX_LENGTH, ], 'entity_id' => [ @@ -101,7 +101,8 @@ * Change {history}.nid to {history}.entity_id and add {history}.entity_type. */ function history_update_8801() { - $schema = Database::getConnection()->schema(); + $database = Database::getConnection(); + $schema = $database->schema(); $schema->dropPrimaryKey('history'); $schema->dropIndex('history', 'nid'); $schema->changeField('history', 'nid', 'entity_id', [ @@ -115,9 +116,15 @@ 'description' => 'The type of the entity that was read.', 'type' => 'varchar_ascii', 'not null' => TRUE, - 'default' => 'node', + 'default' => '', 'length' => EntityTypeInterface::ID_MAX_LENGTH, ]); + + // Set default value for {history}.entity_type. + $database->update('history') + ->fields(['entity_type' => 'node']) + ->execute(); + $schema->addPrimaryKey('history', ['entity_type', 'uid', 'entity_id']); $spec = [ 'description' => 'A record of which {users} have read which entities.', @@ -132,7 +139,7 @@ 'description' => 'The type of the entity that was read.', 'type' => 'varchar_ascii', 'not null' => TRUE, - 'default' => 'node', + 'default' => '', 'length' => EntityTypeInterface::ID_MAX_LENGTH, ], 'entity_id' => [ diff -u b/core/modules/history/src/HistoryRepository.php b/core/modules/history/src/HistoryRepository.php --- b/core/modules/history/src/HistoryRepository.php +++ b/core/modules/history/src/HistoryRepository.php @@ -23,14 +23,14 @@ } /** - * Array of history keyed by entity type and entity id. + * An array of history IDs keyed by entity type and entity id. * * @var array */ protected $history = []; /** - * Database connection. + * The database connection. * * @var \Drupal\Core\Database\Connection */ diff -u b/core/modules/history/src/HistoryRepositoryInterface.php b/core/modules/history/src/HistoryRepositoryInterface.php --- b/core/modules/history/src/HistoryRepositoryInterface.php +++ b/core/modules/history/src/HistoryRepositoryInterface.php @@ -65,7 +65,2 @@ - /** - * Resets the static cache. - */ - public function resetCache(); - }