summaryrefslogtreecommitdiff
path: root/modules/dblog/dblog.install
blob: 41db4cc4f21f09c7870a6393cbb16d3a48959ba4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
// $Id$

/**
 * Implementation of hook_install().
 */
function dblog_install() {
  // Create tables.
  drupal_install_schema('dblog');
}

/**
 * Implementation of hook_uninstall().
 */
function dblog_uninstall() {
  // Remove tables.
  drupal_uninstall_schema('dblog');
}

/**
 * Implementation of hook_schema().
 */
function dblog_schema() {
  $schema['watchdog'] = array(
    'fields' => array(
      'wid'       => array('type' => 'serial', 'not null' => TRUE),
      'uid'       => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
      'type'      => array('type' => 'varchar', 'length' => 16, 'not null' => TRUE, 'default' => ''),
      'message'   => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
      'variables' => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
      'severity'  => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'),
      'link'      => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
      'location'  => array('type' => 'text', 'not null' => TRUE),
      'referer'   => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''),
      'hostname'  => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''),
      'timestamp' => array('type' => 'int', 'not null' => TRUE, 'default' => 0)
    ),
    'primary key' => array('wid'),
    'indexes' => array('type' => array('type')),
  );

  return $schema;
}