1.20.x simpletest.install simpletest_schema()

Implements hook_schema().

File

modules/simpletest/simpletest.install, line 79
Install, update and uninstall functions for the simpletest module.

Code

function simpletest_schema() {
  $schema['simpletest'] = array(
    'description' => 'Stores simpletest messages',
    'fields' => array(
      'message_id' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'Primary Key: Unique simpletest message ID.',
      ),
      'test_id' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Test ID, messages belonging to the same ID are reported together',
      ),
      'test_class' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The name of the class that created this message.',
      ),
      'status' => array(
        'type' => 'varchar',
        'length' => 9,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Message status. Core understands pass, fail, exception.',
      ),
      'message' => array(
        'type' => 'text',
        'not null' => TRUE,
        'description' => 'The message itself.',
      ),
      'message_group' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The message group this message belongs to. For example: warning, browser, user.',
      ),
      'function' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Name of the assertion function or method that created this message.',
      ),
      'line' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Line number on which the function is called.',
      ),
      'file' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Name of the file where the function is called.',
      ),
    ),
    'primary key' => array('message_id'),
    'indexes' => array(
      'reporter' => array('test_class', 'message_id'),
    ),
  );
  $schema['simpletest_prefix'] = array(
    'description' => 'Stores simpletest test IDs and active database table prefixes.',
    'fields' => array(
      'test_id' => array(
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'description' => 'Unique simpletest ID used to group test results together.',
      ),
      'prefix' => array(
        'type' => 'varchar',
        'length' => 60,
        'not null' => FALSE,
        'default' => '',
        'description' => 'The database prefix used during testing. Multiple prefixes may be used at the same time if using the run-scripts.sh script with concurrency.',
      ),
    ),
    'indexes' => array(
      'test_id' => array('test_id'),
      'prefix' => array('prefix'),
    ),
  );
  return $schema;
}