You are here

function nodeviewcount_schema in Node view count 7

Same name and namespace in other branches
  1. 8 nodeviewcount.install \nodeviewcount_schema()
  2. 7.3 nodeviewcount.install \nodeviewcount_schema()
  3. 7.2 nodeviewcount.install \nodeviewcount_schema()

Implements hook_schema().

File

./nodeviewcount.install, line 6

Code

function nodeviewcount_schema() {
  $schema = array();
  $schema['nodeviewcount'] = array(
    'description' => 'The count views of node for every user.',
    'fields' => array(
      'id' => array(
        'description' => 'The unique ID.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'nid' => array(
        'description' => 'The node ID.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'uid' => array(
        'description' => 'The user ID who view of node.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'timestamp' => array(
        'description' => 'The Unix timestamp when the node was view.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'id',
    ),
    'indexes' => array(
      'nid_uid' => array(
        'uid',
        'nid',
      ),
      'timestamp' => array(
        'timestamp',
      ),
    ),
  );
  return $schema;
}