dblog.install 2.5 KB

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