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