5 * Installation functions for History module.
8 use Drupal\Core\Database\Database;
11 * Implements hook_schema().
13 function history_schema() {
14 $schema['history'] = [
15 'description' => 'A record of which {users} have read which {node}s.',
18 'description' => 'The {users}.uid that read the {node} nid.',
24 'description' => 'The {node}.nid that was read.',
31 'description' => 'The Unix timestamp at which the read occurred.',
37 'primary key' => ['uid', 'nid'],
47 * Change {history}.nid to an unsigned int in order to match {node}.nid.
49 function history_update_8101() {
50 $schema = Database::getConnection()->schema();
51 $schema->dropPrimaryKey('history');
52 $schema->dropIndex('history', 'nid');
53 $schema->changeField('history', 'nid', 'nid', [
54 'description' => 'The {node}.nid that was read.',
60 $schema->addPrimaryKey('history', ['uid', 'nid']);
62 'description' => 'A record of which {users} have read which {node}s.',
65 'description' => 'The {users}.uid that read the {node} nid.',
71 'description' => 'The {node}.nid that was read.',
78 'description' => 'The Unix timestamp at which the read occurred.',
84 'primary key' => ['uid', 'nid'],
89 $schema->addIndex('history', 'nid', ['nid'], $spec);