function tracker_schema

Same name in other branches
  1. 9 core/modules/tracker/tracker.install \tracker_schema()
  2. 8.9.x core/modules/tracker/tracker.install \tracker_schema()
  3. 10 core/modules/tracker/tracker.install \tracker_schema()
  4. 11.x core/modules/tracker/tracker.install \tracker_schema()

Implements hook_schema().

File

modules/tracker/tracker.install, line 32

Code

function tracker_schema() {
    $schema['tracker_node'] = array(
        'description' => 'Tracks when nodes were last changed or commented on.',
        'fields' => array(
            'nid' => array(
                'description' => 'The {node}.nid this record tracks.',
                'type' => 'int',
                'unsigned' => TRUE,
                'not null' => TRUE,
                'default' => 0,
            ),
            'published' => array(
                'description' => 'Boolean indicating whether the node is published.',
                'type' => 'int',
                'not null' => FALSE,
                'default' => 0,
                'size' => 'tiny',
            ),
            'changed' => array(
                'description' => 'The Unix timestamp when the node was most recently saved or commented on.',
                'type' => 'int',
                'unsigned' => TRUE,
                'not null' => TRUE,
                'default' => 0,
            ),
        ),
        'indexes' => array(
            'tracker' => array(
                'published',
                'changed',
            ),
        ),
        'primary key' => array(
            'nid',
        ),
        'foreign keys' => array(
            'tracked_node' => array(
                'table' => 'node',
                'columns' => array(
                    'nid' => 'nid',
                ),
            ),
        ),
    );
    $schema['tracker_user'] = array(
        'description' => 'Tracks when nodes were last changed or commented on, for each user that authored the node or one of its comments.',
        'fields' => array(
            'nid' => array(
                'description' => 'The {node}.nid this record tracks.',
                'type' => 'int',
                'unsigned' => TRUE,
                'not null' => TRUE,
                'default' => 0,
            ),
            'uid' => array(
                'description' => 'The {users}.uid of the node author or commenter.',
                'type' => 'int',
                'not null' => TRUE,
                'default' => 0,
            ),
            'published' => array(
                'description' => 'Boolean indicating whether the node is published.',
                'type' => 'int',
                'not null' => FALSE,
                'default' => 0,
                'size' => 'tiny',
            ),
            'changed' => array(
                'description' => 'The Unix timestamp when the node was most recently saved or commented on.',
                'type' => 'int',
                'unsigned' => TRUE,
                'not null' => TRUE,
                'default' => 0,
            ),
        ),
        'indexes' => array(
            'tracker' => array(
                'uid',
                'published',
                'changed',
            ),
        ),
        'primary key' => array(
            'nid',
            'uid',
        ),
        'foreign keys' => array(
            'tracked_node' => array(
                'table' => 'node',
                'columns' => array(
                    'nid' => 'nid',
                ),
            ),
            'tracked_user' => array(
                'table' => 'users',
                'columns' => array(
                    'uid' => 'uid',
                ),
            ),
        ),
    );
    return $schema;
}

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