function history_schema

Same name and namespace in other branches
  1. 9 core/modules/history/history.install \history_schema()
  2. 8.9.x core/modules/history/history.install \history_schema()
  3. 10 core/modules/history/history.install \history_schema()

Implements hook_schema().

File

core/modules/history/history.install, line 11

Code

function history_schema() {
    $schema['history'] = [
        'description' => 'A record of which {users} have read which {node}s.',
        'fields' => [
            'uid' => [
                'description' => 'The {users}.uid that read the {node} nid.',
                'type' => 'int',
                'not null' => TRUE,
                'default' => 0,
            ],
            'nid' => [
                'description' => 'The {node}.nid that was read.',
                'type' => 'int',
                'unsigned' => TRUE,
                'not null' => TRUE,
                'default' => 0,
            ],
            'timestamp' => [
                'description' => 'The Unix timestamp at which the read occurred.',
                'type' => 'int',
                'not null' => TRUE,
                'default' => 0,
                'size' => 'big',
            ],
        ],
        'primary key' => [
            'uid',
            'nid',
        ],
        'indexes' => [
            'nid' => [
                'nid',
            ],
        ],
    ];
    return $schema;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.