dblog.install 2.62 KB
Newer Older
1 2
<?php

3 4 5 6 7
/**
 * @file
 * Install, update and uninstall functions for the dblog module.
 */

8
/**
9
 * Implements hook_schema().
10 11 12
 */
function dblog_schema() {
  $schema['watchdog'] = array(
13
    'description' => 'Table that contains logs of all system events.',
14
    'fields' => array(
15 16 17
      'wid' => array(
        'type' => 'serial',
        'not null' => TRUE,
18
        'description' => 'Primary Key: Unique watchdog event ID.',
19 20 21
      ),
      'uid' => array(
        'type' => 'int',
22
        'unsigned' => TRUE,
23 24
        'not null' => TRUE,
        'default' => 0,
25
        'description' => 'The {users}.uid of the user who triggered the event.',
26 27 28
      ),
      'type' => array(
        'type' => 'varchar',
29
        'length' => 64,
30 31
        'not null' => TRUE,
        'default' => '',
32
        'description' => 'Type of log message, for example "user" or "page not found."',
33 34 35 36 37
      ),
      'message' => array(
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
38
        'description' => 'Text of log message to be passed into the t() function.',
39 40
      ),
      'variables' => array(
41
        'type' => 'blob',
42 43
        'not null' => TRUE,
        'size' => 'big',
44
        'description' => 'Serialized array of variables that match the message string and that is passed into the t() function.',
45 46 47 48 49 50 51
      ),
      'severity' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
52
        'description' => 'The severity level of the event; ranges from 0 (Emergency) to 7 (Debug)',
53 54 55 56
      ),
      'link' => array(
        'type' => 'varchar',
        'length' => 255,
57
        'not null' => FALSE,
58
        'default' => '',
59
        'description' => 'Link to view the result of the event.',
60 61 62 63
      ),
      'location'  => array(
        'type' => 'text',
        'not null' => TRUE,
64
        'description' => 'URL of the origin of the event.',
65 66
      ),
      'referer' => array(
67
        'type' => 'text',
68
        'not null' => FALSE,
69
        'description' => 'URL of referring page.',
70 71 72 73 74 75
      ),
      'hostname' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
76
        'description' => 'Hostname of the user who triggered the event.',
77 78 79 80 81
      ),
      'timestamp' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
82
        'description' => 'Unix timestamp of when event occurred.',
83
      ),
84 85
    ),
    'primary key' => array('wid'),
86 87
    'indexes' => array(
      'type' => array('type'),
88
      'uid' => array('uid'),
89
      'severity' => array('severity'),
90
    ),
91 92 93 94
  );

  return $schema;
}