You are here

protected function ModuleInstaller::installSchema in Drupal 10

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Extension/ModuleInstaller.php \Drupal\Core\Extension\ModuleInstaller::installSchema()

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

@internal

Parameters

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

File

core/lib/Drupal/Core/Extension/ModuleInstaller.php, line 636

Class

ModuleInstaller
Default implementation of the module installer.

Namespace

Drupal\Core\Extension

Code

protected function installSchema(string $module) : void {
  $tables = $this->moduleHandler
    ->invoke($module, 'schema') ?? [];
  $schema = $this->connection
    ->schema();
  foreach ($tables as $name => $table) {
    $schema
      ->createTable($name, $table);
  }
}