function search_autocomplete_schema in Search Autocomplete 7.2
Same name and namespace in other branches
- 6.4 search_autocomplete.install \search_autocomplete_schema()
- 6.2 search_autocomplete.install \search_autocomplete_schema()
- 7.4 search_autocomplete.install \search_autocomplete_schema()
- 7.3 search_autocomplete.install \search_autocomplete_schema()
Implementation of hook_schema(). Set the schema of database
Return value
the schema for of the table to create
File
- ./
search_autocomplete.install, line 20 - This file is used to install/update/delete the module tables in database
Code
function search_autocomplete_schema() {
// schema for search_autocomplete database
$schema['search_autocomplete_forms'] = array(
'description' => t('Store the forms to autocomplete using Search Autocomplete.'),
'fields' => array(
'fid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'title' => array(
'description' => 'Human readable name for the form',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'selector' => array(
'description' => 'Reference id selector of the the form in drupal',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'weight' => array(
'description' => 'Form weight in table',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'enabled' => array(
'description' => 'Define if autocomplete is activated or not',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'parent_fid' => array(
'description' => 'Define if the from follows the configuration of another one',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'min_char' => array(
'description' => 'Minimum of character before triggering suggestions',
'type' => 'int',
'not null' => TRUE,
'default' => 3,
),
'max_sug' => array(
'description' => 'Maximum number of suggestions',
'type' => 'int',
'not null' => TRUE,
'default' => 15,
),
),
'primary key' => array(
'fid',
),
);
// schema for search_autocomplete database
$schema['search_autocomplete_suggestions'] = array(
'description' => t('Store the suggestions for this form.'),
'fields' => array(
'sid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'sug_fid' => array(
'description' => 'Form fid the Suggestion belongs to',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'sug_enabled' => array(
'description' => 'Define if suggestion is activated or not',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'sug_prefix' => array(
'description' => 'Human readable prefix in suggestion',
'type' => 'varchar',
'length' => 15,
'not null' => TRUE,
'default' => '',
),
'sug_title' => array(
'description' => 'Human readable title for the suggestion',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'sug_name' => array(
'description' => 'Reference name of the the suggestion in drupal',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'sug_dependencies' => array(
'description' => 'Name of the module (if such) which the suggestion depends on',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'sug_weight' => array(
'description' => 'Suggestion weight in table',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'sug_query' => array(
'description' => 'The database query for this suggestion',
'type' => 'varchar',
'length' => 512,
'not null' => TRUE,
'default' => '',
),
),
);
return $schema;
}