You are here

function nodeviewcount_schema in Node view count 7.3

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

Implements hook_schema().

File

./nodeviewcount.install, line 11
Creates table for views counting.

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,
      ),
      'datetime' => array(
        'description' => 'The date when the node was view.',
        'type' => 'varchar',
        'length' => 100,
        'not null' => TRUE,
        'default' => 0,
      ),
      'uip' => array(
        'description' => 'The user IP who view of node.',
        'type' => 'varchar',
        'length' => 100,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'id',
    ),
    'indexes' => array(
      'nid_uid' => array(
        'uid',
        'nid',
      ),
      'datetime' => array(
        'datetime',
      ),
    ),
  );
  return $schema;
}