Issue #2061843 by TravisCarden: Clean up the docs for hook_schema

8.0.x
Jennifer Hodgdon 2013-08-13 07:55:29 -07:00
parent 5028880dfc
commit 82a7664580
1 changed files with 15 additions and 13 deletions

View File

@ -2318,37 +2318,39 @@ function hook_requirements($phase) {
/**
* Define the current version of the database schema.
*
* A Drupal schema definition is an array structure representing one or
* more tables and their related keys and indexes. A schema is defined by
* A Drupal schema definition is an array structure representing one or more
* tables and their related keys and indexes. A schema is defined by
* hook_schema() which must live in your module's .install file.
*
* This hook is called at install and uninstall time, and in the latter
* case, it cannot rely on the .module file being loaded or hooks being known.
* If the .module file is needed, it may be loaded with drupal_load().
* This hook is called at install and uninstall time, and in the latter case, it
* cannot rely on the .module file being loaded or hooks being known. If the
* .module file is needed, it may be loaded with drupal_load().
*
* The tables declared by this hook will be automatically created when
* the module is first enabled, and removed when the module is uninstalled.
* This happens before hook_install() is invoked, and after hook_uninstall()
* is invoked, respectively.
* The tables declared by this hook will be automatically created when the
* module is first enabled, and removed when the module is uninstalled. This
* happens before hook_install() is invoked, and after hook_uninstall() is
* invoked, respectively.
*
* By declaring the tables used by your module via an implementation of
* hook_schema(), these tables will be available on all supported database
* engines. You don't have to deal with the different SQL dialects for table
* creation and alteration of the supported database engines.
*
* See the Schema API Handbook at http://drupal.org/node/146843 for
* details on schema definition structures.
* See the Schema API Handbook at http://drupal.org/node/146843 for details on
* schema definition structures.
*
* @return
* @return array
* A schema definition structure array. For each element of the
* array, the key is a table name and the value is a table structure
* definition.
*
* @see hook_schema_alter()
*
* @ingroup schemaapi
*/
function hook_schema() {
$schema['node'] = array(
// example (partial) specification for table "node"
// Example (partial) specification for table "node".
'description' => 'The base table for nodes.',
'fields' => array(
'nid' => array(