Load a dump into a site's database
db_restoreLoad a .sql or .sql.gz dump into a site's database, with the site's own credentials: the undo for a bad change, or a restore from a backup. Pass file as list_dumps shows it, or any .sql / .sql.gz file on the server (a backup the user keeps). The database as it is now is dumped first (before-restore-...), so the restore itself can be undone with the same tool. Tables in the file replace the tables of the same name; tables the file does not mention stay. A dump from another database or another site version can break the site: check what the file holds first (read_file the first lines, or list_dumps). Runs in the background: follow with job_output. Say beforehand what will be lost (everything in those tables since the dump). For a few rows or one table, load the dump into a scratch database instead (playbook restore).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| why | No | One plain sentence for the user, shown on the approval page if this call needs their approval: what it does and why it is needed. | |
| file | Yes | The dump to load: a path from list_dumps, or an absolute path to a .sql or .sql.gz file on the server | |
| site | No | Site root folder, like /var/www/shop, or one of the site's domains. Optional when the server has one site (see list_sites). | |
| server | No | Server name or id. Optional when the account has one server. | |
| approval_id | No | Only when repeating a call the user approved. |