function statistics_schema

Same name in other branches
  1. 7.x modules/statistics/statistics.install \statistics_schema()
  2. 9 core/modules/statistics/statistics.install \statistics_schema()
  3. 8.9.x core/modules/statistics/statistics.install \statistics_schema()
  4. 10 core/modules/statistics/statistics.install \statistics_schema()

Implements hook_schema().

File

core/modules/statistics/statistics.install, line 22

Code

function statistics_schema() {
    $schema['node_counter'] = [
        'description' => 'Access statistics for {node}s.',
        'fields' => [
            'nid' => [
                'description' => 'The {node}.nid for these statistics.',
                'type' => 'int',
                'unsigned' => TRUE,
                'not null' => TRUE,
                'default' => 0,
            ],
            'totalcount' => [
                'description' => 'The total number of times the {node} has been viewed.',
                'type' => 'int',
                'unsigned' => TRUE,
                'not null' => TRUE,
                'default' => 0,
                'size' => 'big',
            ],
            'daycount' => [
                'description' => 'The total number of times the {node} has been viewed today.',
                'type' => 'int',
                'unsigned' => TRUE,
                'not null' => TRUE,
                'default' => 0,
                'size' => 'medium',
            ],
            'timestamp' => [
                'description' => 'The most recent time the {node} has been viewed.',
                'type' => 'int',
                'unsigned' => TRUE,
                'not null' => TRUE,
                'default' => 0,
                'size' => 'big',
            ],
        ],
        'primary key' => [
            'nid',
        ],
    ];
    return $schema;
}

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