diff --git a/core/includes/schema.inc b/core/includes/schema.inc
index aa3984b..3547dbf 100644
--- a/core/includes/schema.inc
+++ b/core/includes/schema.inc
@@ -1,9 +1,6 @@
 <?php
 
-/**
- * @file
- * Schema API handling functions.
- */
+use Drupal\Core\Database\Database;
 
 /**
  * @addtogroup schemaapi
@@ -119,7 +116,9 @@ function drupal_install_schema($module) {
   _drupal_schema_initialize($schema, $module, FALSE);
 
   foreach ($schema as $name => $table) {
-    db_create_table($name, $table);
+    Database::getConnection('default', $schema[$name]['database key'])
+      ->schema()
+      ->createTable($name, $table);
   }
 }
 
@@ -133,9 +132,10 @@ function drupal_uninstall_schema($module) {
   $schema = drupal_get_module_schema($module);
   _drupal_schema_initialize($schema, $module, FALSE);
 
-  foreach ($schema as $table) {
-    if (db_table_exists($table['name'])) {
-      db_drop_table($table['name']);
+  foreach ($schema as $name => $table) {
+    $connection = Database::getConnection('default', $schema[$name]['database key']);
+    if ($connection->schema()->tableExists($table['name'])) {
+      $connection->schema()->dropTable($table['name']);
     }
   }
 }
@@ -152,6 +152,9 @@ function drupal_uninstall_schema($module) {
  * @param string $table
  *   The name of the table. If not given, the module's complete schema
  *   is returned.
+ *
+ * @return array
+ *   The module's schema or empty string if not found.
  */
 function drupal_get_module_schema($module, $table = NULL) {
   // Load the .install file to get hook_schema.
@@ -192,6 +195,9 @@ function _drupal_schema_initialize(&$schema, $module, $remove_descriptions = TRU
     if (!isset($table['name'])) {
       $table['name'] = $name;
     }
+    if (!isset($table['database key'])) {
+      $table['database key'] = 'default';
+    }
     if ($remove_descriptions) {
       unset($table['description']);
       foreach ($table['fields'] as &$field) {
