dblog.install

  1. 7.x drupal-7.x/modules/dblog/dblog.install
  2. 6.x drupal-6.x/modules/dblog/dblog.install

File

drupal-6.x/modules/dblog/dblog.install
View source
  1. <?php
  2. /**
  3. * Implementation of hook_install().
  4. */
  5. function dblog_install() {
  6. // Create tables.
  7. drupal_install_schema('dblog');
  8. }
  9. /**
  10. * Implementation of hook_uninstall().
  11. */
  12. function dblog_uninstall() {
  13. // Remove tables.
  14. drupal_uninstall_schema('dblog');
  15. }
  16. /**
  17. * Implementation of hook_schema().
  18. */
  19. function dblog_schema() {
  20. $schema['watchdog'] = array(
  21. 'description' => 'Table that contains logs of all system events.',
  22. 'fields' => array(
  23. 'wid' => array(
  24. 'type' => 'serial',
  25. 'not null' => TRUE,
  26. 'description' => 'Primary Key: Unique watchdog event ID.',
  27. ),
  28. 'uid' => array(
  29. 'type' => 'int',
  30. 'not null' => TRUE,
  31. 'default' => 0,
  32. 'description' => 'The {users}.uid of the user who triggered the event.',
  33. ),
  34. 'type' => array(
  35. 'type' => 'varchar',
  36. 'length' => 16,
  37. 'not null' => TRUE,
  38. 'default' => '',
  39. 'description' => 'Type of log message, for example "user" or "page not found."',
  40. ),
  41. 'message' => array(
  42. 'type' => 'text',
  43. 'not null' => TRUE,
  44. 'size' => 'big',
  45. 'description' => 'Text of log message to be passed into the t() function.',
  46. ),
  47. 'variables' => array(
  48. 'type' => 'text',
  49. 'not null' => TRUE,
  50. 'size' => 'big',
  51. 'description' => 'Serialized array of variables that match the message string and that is passed into the t() function.',
  52. ),
  53. 'severity' => array(
  54. 'type' => 'int',
  55. 'unsigned' => TRUE,
  56. 'not null' => TRUE,
  57. 'default' => 0,
  58. 'size' => 'tiny',
  59. 'description' => 'The severity level of the event; ranges from 0 (Emergency) to 7 (Debug)',
  60. ),
  61. 'link' => array(
  62. 'type' => 'varchar',
  63. 'length' => 255,
  64. 'not null' => TRUE,
  65. 'default' => '',
  66. 'description' => 'Link to view the result of the event.',
  67. ),
  68. 'location' => array(
  69. 'type' => 'text',
  70. 'not null' => TRUE,
  71. 'description' => 'URL of the origin of the event.',
  72. ),
  73. 'referer' => array(
  74. 'type' => 'text',
  75. 'not null' => FALSE,
  76. 'description' => 'URL of referring page.',
  77. ),
  78. 'hostname' => array(
  79. 'type' => 'varchar',
  80. 'length' => 128,
  81. 'not null' => TRUE,
  82. 'default' => '',
  83. 'description' => 'Hostname of the user who triggered the event.',
  84. ),
  85. 'timestamp' => array(
  86. 'type' => 'int',
  87. 'not null' => TRUE,
  88. 'default' => 0,
  89. 'description' => 'Unix timestamp of when event occurred.',
  90. ),
  91. ),
  92. 'primary key' => array('wid'),
  93. 'indexes' => array('type' => array('type')),
  94. );
  95. return $schema;
  96. }
  97. /**
  98. * @addtogroup updates-6.x-extra
  99. * @{
  100. */
  101. /**
  102. * Allow longer referrers.
  103. */
  104. function dblog_update_6000() {
  105. $ret = array();
  106. db_change_field($ret, 'watchdog', 'referer', 'referer', array('type' => 'text', 'not null' => FALSE));
  107. return $ret;
  108. }
  109. /**
  110. * @} End of "addtogroup updates-6.x-extra".
  111. * The next series of updates should start at 7000.
  112. */