Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ModuleInstaller.php

function ModuleInstaller::uninstallSchema

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

@internal

Parameters

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

1 call to ModuleInstaller::uninstallSchema()
ModuleInstaller::uninstall in core/lib/Drupal/Core/Extension/ModuleInstaller.php
Uninstalls a given list of modules.

File

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

Class

ModuleInstaller
Default implementation of the module installer.

Namespace

Drupal\Core\Extension

Code

protected function uninstallSchema(string $module) : void {
    $tables = $this->invoke($module, 'schema') ?? [];
    $schema = $this->connection
        ->schema();
    foreach (array_keys($tables) as $table) {
        if ($schema->tableExists($table)) {
            $schema->dropTable($table);
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal