You are here

function monitoring_schema in Monitoring 7

Implements hook_schema().

File

./monitoring.install, line 10
Monitoring base install file.

Code

function monitoring_schema() {
  $schema['monitoring_sensor_result'] = array(
    'description' => 'Monitoring sensor data captured on their invocation.',
    'fields' => array(
      'record_id' => array(
        'description' => 'The identifier of the call',
        'type' => 'serial',
        'not null' => TRUE,
      ),
      'sensor_name' => array(
        'description' => 'The sensor name invoked',
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
      ),
      'sensor_status' => array(
        'description' => 'Sensor status at the time of the call',
        'type' => 'varchar',
        'length' => '16',
        'not null' => TRUE,
      ),
      'sensor_message' => array(
        'description' => 'Sensor status message',
        'type' => 'text',
        'not null' => TRUE,
      ),
      'sensor_value' => array(
        'description' => 'Sensor value',
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
      ),
      'timestamp' => array(
        'description' => 'Timestamp of the sensor call',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'execution_time' => array(
        'description' => 'Sensor execution time duration value in milliseconds',
        'type' => 'numeric',
        'not null' => TRUE,
        'precision' => 10,
        'scale' => 2,
        'default' => 0.0,
      ),
    ),
    'primary key' => array(
      'record_id',
    ),
    'indexes' => array(
      'sensor_name' => array(
        'sensor_name',
      ),
    ),
  );
  return $schema;
}