You are here

function quail_api_schema in Quail API 7

Same name and namespace in other branches
  1. 8 quail_api.install \quail_api_schema()

Implementation of hook_schema().

File

./quail_api.install, line 67
Install file for the quail api.

Code

function quail_api_schema() {
  $schema = array();
  $schema['quail_api_tests'] = array(
    'fields' => array(
      'id' => array(
        'description' => st("A numerical primary key that uniquely represents this node type. Any foreign keys should point to this."),
        'type' => 'serial',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'size' => 'big',
      ),
      'severity' => array(
        'description' => st("This is the numeric representation of the quail test display levels."),
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'machine_name' => array(
        'description' => st("This is the machine-friendly name used by the quail library that represents the test."),
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
      'human_name' => array(
        'description' => st("This is the human-friendly name used by the quail library that represents the test."),
        'type' => 'text',
        'size' => 'normal',
        'not null' => TRUE,
        'default' => '',
      ),
      'description' => array(
        'description' => st("This is the description the test that this row represents."),
        'type' => 'text',
        'size' => 'medium',
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'id',
    ),
    'unique keys' => array(
      'machine_name' => array(
        'machine_name',
      ),
    ),
  );

  // workaround mysql's violation of the SQL standard in a way that does not break standards-compliant databases.
  // @see https://dev.mysql.com/doc/refman/5.6/en/data-type-defaults.html
  // @see https://bugs.mysql.com/bug.php?id=25520
  // @see https://drupal.org/node/1401782
  // @see https://drupal.org/node/143881
  if (db_driver() == 'mysql') {
    unset($schema['quail_api_tests']['fields']['human_name']['default']);
    unset($schema['quail_api_tests']['fields']['description']['default']);
  }
  return $schema;
}