quail_api.install in Quail API 8
Same filename and directory in other branches
Install file for the quail api.
File
quail_api.installView source
<?php
/**
* @file
* Install file for the quail api.
*/
/**
* Implementation of hook_schema().
*/
function quail_api_schema() {
$schema = array();
$schema['quail_api_tests'] = [
'fields' => [
'id' => [
'description' => t("A numerical primary key that uniquely represents the test. Any foreign keys should point to this."),
'type' => 'serial',
'not null' => TRUE,
'unsigned' => TRUE,
'size' => 'big',
],
'severity' => [
'description' => t("This is the numeric representation of the quail test display levels."),
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
],
'machine_name' => [
'description' => t("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' => [
'description' => t("This is the human-friendly name used by the quail library that represents the test."),
'type' => 'text',
'size' => 'normal',
'not null' => TRUE,
'default' => '',
],
'description' => [
'description' => t("This is the description the test that this row represents."),
'type' => 'text',
'size' => 'medium',
'not null' => TRUE,
'default' => '',
],
],
'primary key' => [
'id',
],
'unique keys' => [
'machine_name' => [
'machine_name',
],
],
];
// mysql often does not support default values on text fields, so remove it.
if (\Drupal::database()
->driver() == 'mysql') {
unset($schema['quail_api_tests']['fields']['human_name']['default']);
unset($schema['quail_api_tests']['fields']['description']['default']);
}
return $schema;
}
/**
* Implementation of hook_disable().
*/
function quail_api_disable() {
Drupal\quail_api\QuailApiBase::reset_cache();
}
Functions
Name | Description |
---|---|
quail_api_disable | Implementation of hook_disable(). |
quail_api_schema | Implementation of hook_schema(). |