You are here

function statistics_schema in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/statistics/statistics.install \statistics_schema()
  2. 6 modules/statistics/statistics.install \statistics_schema()
  3. 7 modules/statistics/statistics.install \statistics_schema()
  4. 9 core/modules/statistics/statistics.install \statistics_schema()

Implements hook_schema().

File

core/modules/statistics/statistics.install, line 20
Install and update functions for the Statistics module.

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,
      ],
    ],
    'primary key' => [
      'nid',
    ],
  ];
  return $schema;
}