function hook_install

7.x system.api.php hook_install()
6.x install.php hook_install()

Install the current version of the database schema, and any other setup tasks.

Implementations of this hook must be declared in the module's .install file. The hook will only be called the first time a module is installed, and the module's schema version will be set to the module's greatest numbered update hook. Because of this, anytime a hook_update_N() is added to the module, this function needs to be updated to reflect the current version of the database schema.

See the Schema API documentation at http://drupal.org/node/146843 for details on hook_schema, where a database tables are defined.

Note that functions declared in the module being installed are not yet available. The implementation of hook_install() will need to explicitly load the module before any declared functions may be invoked.

Anything added or modified in this function that can be removed during uninstall should be removed with hook_uninstall().

Related topics

19 functions implement hook_install()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

aggregator_install in drupal-6.x/modules/aggregator/aggregator.install
Implementation of hook_install().
blogapi_install in drupal-6.x/modules/blogapi/blogapi.install
Implementation of hook_install().
book_install in drupal-6.x/modules/book/book.install
Implementation of hook_install().
contact_install in drupal-6.x/modules/contact/contact.install
Implementation of hook_install().
dblog_install in drupal-6.x/modules/dblog/dblog.install
Implementation of hook_install().

... See full list

4 invocations of hook_install()
drupal_check_module in drupal-6.x/includes/install.inc
Check a module's requirements.
drupal_check_profile in drupal-6.x/includes/install.inc
Check a profile's requirements.
drupal_install_system in drupal-6.x/includes/install.inc
Callback to install the system module.
_drupal_install_module in drupal-6.x/includes/install.inc
Callback to install an individual profile module.

File

documentation-6.x/developer/hooks/install.php, line 202
Documentation for the installation and update system.

Code

function hook_install() {
  drupal_install_schema('upload');
}