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