Fill in required default values for table definitions returned by hook_schema().

Parameters

$module: The module for which hook_schema() was invoked.

$schema: The schema definition array as it was returned by the module's hook_schema().

Related topics

2 calls to _drupal_initialize_schema()
drupal_install_schema in includes/common.inc
Create all tables that a module defines in its hook_schema().
drupal_uninstall_schema in includes/common.inc
Remove all tables that a module defines in its hook_schema().

File

includes/common.inc, line 3480
Common functions that many Drupal modules will need to reference.

Code

function _drupal_initialize_schema($module, &$schema) {

  // Set the name and module key for all tables.
  foreach ($schema as $name => $table) {
    if (empty($table['module'])) {
      $schema[$name]['module'] = $module;
    }
    if (!isset($table['name'])) {
      $schema[$name]['name'] = $name;
    }
  }
}