You are here

function drupal_install_schema in Drupal 9

Same name and namespace in other branches
  1. 8 core/includes/schema.inc \drupal_install_schema()
  2. 6 includes/common.inc \drupal_install_schema()
  3. 7 includes/common.inc \drupal_install_schema()

Creates all tables defined in a module's hook_schema().

Parameters

string $module: The module for which the tables will be created.

Deprecated

in drupal:9.2.0 and is removed from drupal:10.0.0. No direct replacement is provided.

See also

https://www.drupal.org/node/2970993

\Drupal\Core\Extension\ModuleInstaller::installSchema()

Related topics

1 call to drupal_install_schema()
SchemaDeprecationTest::testDeprecatedInstallSchema in core/tests/Drupal/KernelTests/Core/Extension/SchemaDeprecationTest.php
Tests deprecation of database schema API functions.

File

core/includes/schema.inc, line 112
Schema API handling functions.

Code

function drupal_install_schema($module) {
  @trigger_error('drupal_install_schema() is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. No direct replacement is provided. See https://www.drupal.org/node/2970993', E_USER_DEPRECATED);
  $schema = drupal_get_module_schema($module);
  _drupal_schema_initialize($schema, $module, FALSE);
  foreach ($schema as $name => $table) {
    \Drupal::database()
      ->schema()
      ->createTable($name, $table);
  }
}