diff --git a/core/scripts/dump-database-d8.php b/core/scripts/dump-database-d8.php
new file mode 100644
index 0000000..a588e96
--- /dev/null
+++ b/core/scripts/dump-database-d8.php
@@ -0,0 +1,95 @@
+<?php
+
+/**
+ * @file
+ * Dumps a Drupal 8 database into a Drupal 8 PHP script to test the upgrade
+ * process.
+ *
+ * Run this script at the root of an existing Drupal 8 installation.
+ *
+ * The output of this script is a PHP script that can be run inside Drupal 8
+ * and recreates the Drupal 8 database as dumped. Transient data from cache,
+ * session, and watchdog tables are not recorded.
+ */
+
+use Drupal\Component\Utility\Variable;
+use Drupal\Core\DrupalKernel;
+use Drupal\Core\Site\Settings;
+use Symfony\Component\HttpFoundation\Request;
+
+chdir('../..');
+$autoloader = require_once dirname(dirname(__DIR__)) . '/core/vendor/autoload.php';
+
+try {
+  $request = Request::createFromGlobals();
+  $kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod');
+  $kernel->boot()->loadLegacyIncludes();
+
+  // Output the PHP header.
+  $output = <<<ENDOFHEADER
+<?php
+
+/**
+ * @file
+ * Filled installation of Drupal 8.0, for test purposes.
+ *
+ * This file was generated by the dump-database-d8.php tool, from an
+ * installation of Drupal 8. It has the following modules installed:
+
+ENDOFHEADER;
+
+  foreach (\Drupal::moduleHandler()->getModuleList() as $module => $filename) {
+    $output .= " *  - $module\n";
+  }
+  $output .= " */\n\n";
+
+  // Get the current schema, order it by table name.
+  $schema = drupal_get_schema();
+  ksort($schema);
+
+  // Export all the tables in the schema.
+  foreach ($schema as $table => $data) {
+    // Remove descriptions to save time and code.
+    unset($data['description']);
+    foreach ($data['fields'] as &$field) {
+      unset($field['description']);
+    }
+
+    // Dump the table structure.
+    $output .= "db_create_table('" . $table . "', " . Variable::export($data) . ");\n";
+
+    // Don't output values for those tables.
+    if (substr($table, 0, 5) == 'cache' || $table == 'sessions' || $table == 'watchdog') {
+      $output .= "\n";
+      continue;
+    }
+
+    // Prepare the export of values.
+    $result = db_query('SELECT * FROM {' . $table . '}', array(), array('fetch' => PDO::FETCH_ASSOC));
+    $insert = '';
+    foreach ($result as $record) {
+      $insert .= '->values(' . Variable::export($record) . ")\n";
+    }
+
+    // Dump the values if there are some.
+    if ($insert) {
+      $output .= "db_insert('" . $table . "')->fields(" . Variable::export(array_keys($data['fields'])) . ")\n";
+      $output .= $insert;
+      $output .= "->execute();\n";
+    }
+
+    $output .= "\n";
+  }
+
+  print $output;
+}
+catch (Exception $e) {
+  $message = 'If you have just changed code (for example deployed a new module or moved an existing one) read <a href="http://drupal.org/documentation/rebuild">http://drupal.org/documentation/rebuild</a>';
+  if (Settings::get('rebuild_access', FALSE)) {
+    $rebuild_path = $GLOBALS['base_url'] . '/rebuild.php';
+    $message .= " or run the <a href=\"$rebuild_path\">rebuild script</a>";
+  }
+
+  print $message;
+  print $e->getMessage();
+}
