Skip to content

archive:restore

Restore (import) your code, files, and database.

Examples

  • drush archive:restore /path/to/archive.tar.gz. Restore the site from /path/to/archive.tar.gz archive file.
  • drush archive:restore /path/to/archive.tar.gz --destination-path=/path/to/restore. Restore the site from /path/to/archive.tar.gz archive file into /path/to/restore directory.
  • drush archive:restore /path/to/archive.tar.gz --code --destination-path=/path/to/restore. Restore the code from /path/to/archive.tar.gz archive file into /path/to/restore directory.
  • drush archive:restore /path/to/archive.tar.gz --code-source-path=/code/source/path. Restore database and Drupal files from /path/to/archive.tar.gz archive file and the code from /code/source/path directory.
  • drush archive:restore /path/to/archive.tar.gz --files --destination-path=/path/to/restore. Restore the Drupal files from /path/to/archive.tar.gz archive file into /path/to/restore directory
  • drush archive:restore /path/to/archive.tar.gz --files-source-path=/files/source/path. Restore code and database from /path/to/archive.tar.gz archive file and the Drupal files from /files/source/path directory.
  • drush archive:restore /path/to/archive.tar.gz --files-destination-relative-path=web/site/foo-bar/files. Restore the Drupal files from /path/to/archive.tar.gz archive file into web/site/foo-bar/files site's subdirectory.
  • drush archive:restore /path/to/archive.tar.gz --db. Restore the database from /path/to/archive.tar.gz archive file.
  • drush archive:restore /path/to/archive.tar.gz --db-source-path=/path/to/database.sql. Restore code and Drupal files from /path/to/archive.tar.gz archive file and the database from /path/to/database.sql dump file.
  • drush archive:restore /path/to/archive.tar.gz --db-url=mysql://user:password@localhost/database_name --destination-path=/path/to/restore. Restore code, database and Drupal files from /path/to/archive.tar.gz archive file into /path/to/restore directory using database URL.

Arguments

  • [path]. The full path to a single archive file (*.tar.gz) or a directory with components to import. May contain the following components generated by archive:dump command: 1) code ("code" directory); 2) database dump file ("database/database.sql" file); 3) Drupal files ("files" directory).
  • [site]. Destination site alias. Defaults to @self.

Options

  • --destination-path[=DESTINATION-PATH]. The base path to restore the code/files into.
  • --overwrite. Overwrite files if exists when un-compressing an archive.
  • --site-subdir[=SITE-SUBDIR]. Site subdirectory to put settings.local.php into. [default: default]
  • --setup-database-connection[=SETUP-DATABASE-CONNECTION]. Sets up the database connection in settings.local.php file if either --db-url option or set of specific --db- options are provided. [default: 1*]
  • --code. Import code.
  • --code-source-path[=CODE-SOURCE-PATH]. Import code from specified directory. Has higher priority over "path" argument.
  • --files. Import Drupal files.
  • --files-source-path[=FILES-SOURCE-PATH]. Import Drupal files from specified directory. Has higher priority over "path" argument.
  • --files-destination-relative-path[=FILES-DESTINATION-RELATIVE-PATH]. Import Drupal files into specified directory relative to Composer root.
  • --db. Import database.
  • --db-source-path[=DB-SOURCE-PATH]. Import database from specified dump file. Has higher priority over "path" argument.
  • --db-driver[=DB-DRIVER]. Destination database driver. [default: mysql]
  • --db-port[=DB-PORT]. Destination database port.
  • --db-host[=DB-HOST]. Destination database host.
  • --db-name[=DB-NAME]. Destination database name.
  • --db-user[=DB-USER]. Destination database user.
  • --db-password[=DB-PASSWORD]. Destination database user password.
  • --db-prefix[=DB-PREFIX]. Destination database prefix.
  • --no-setup-database-connection. Negate --setup-database-connection option.
  • --database[=DATABASE]. The DB connection key if using multiple connections in settings.php. [default: default]
  • --target[=TARGET]. The name of a target within the specified database connection. [default: default]
  • --db-url=DB-URL. A Drupal 6 style database URL. For example mysql://root:pass@localhost:port/dbname
  • --show-passwords. Show password on the CLI. Useful for debugging.
  • --skip-tables-key=SKIP-TABLES-KEY. A key in the $skip_tables array. @see Site aliases
  • --structure-tables-key=STRUCTURE-TABLES-KEY. A key in the $structure_tables array. @see Site aliases
  • --tables-key=TABLES-KEY. A key in the $tables array.
  • --skip-tables-list=SKIP-TABLES-LIST. A comma-separated list of tables to exclude completely.
  • --structure-tables-list=STRUCTURE-TABLES-LIST. A comma-separated list of tables to include for structure, but not data.
  • --tables-list=TABLES-LIST. A comma-separated list of tables to transfer.

Global Options

  • -v|vv|vvv, --verbose. Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
  • -y, --yes. Auto-accept the default for all user prompts. Equivalent to --no-interaction.
  • -l, --uri=URI. A base URL for building links and selecting a multi-site. Defaults to https://default.
  • To see all global options, run drush topic and pick the first choice.

Aliases

  • arr

Legend

  • An argument or option with square brackets is optional.
  • Any default value is listed at end of arg/option description.
  • An ellipsis indicates that an argument accepts multiple values separated by a space.