function drupal_uninstall_schema
Same name in other branches
- 7.x includes/common.inc \drupal_uninstall_schema()
- 8.9.x core/includes/schema.inc \drupal_uninstall_schema()
Removes all tables defined in a module's hook_schema().
Parameters
string $module: The module for which the tables will be removed.
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::uninstallSchema()
Related topics
1 call to drupal_uninstall_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 134
Code
function drupal_uninstall_schema($module) {
@trigger_error('drupal_uninstall_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);
$tables = drupal_get_module_schema($module);
_drupal_schema_initialize($tables, $module, FALSE);
$schema = \Drupal::database()->schema();
foreach ($tables as $table) {
if ($schema->tableExists($table['name'])) {
$schema->dropTable($table['name']);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.