{% extends "admin/dbs/wiki/_layout.html" %} {% block wiki %}
Restore a backup kept in DBS_BACKUP_DIR from its row under
Backups, or upload a
.dbs file under Restore. The
restore runs in the background, outside the web request, on a page that refreshes until it
ends; only one backup or restore runs at a time. Taking a backup works the same way, and its
download is served from the finished file in DBS_BACKUP_DIR.
Dry run performs the real load inside a transaction it rolls back, writes no
files and never touches a sequence. It reports what would be restored, names every file a
real restore would refuse, and changes nothing. From a shell,
python manage.py dbs restore FILE --dry-run exits non-zero when a file would be
refused.
By default a restore merges into existing rows: rows created since the backup stay, and an existing row only takes the fields the backup carries. Replace instead of merge first deletes the rows the backup covers — children before parents, in the same transaction as the load — so a failure leaves the database untouched.
Every file's target is checked before any row loads. Files are written beside their
targets and moved into place only when the rows commit, and removed again if the load fails.
They may land inside DBS_RESTORE_ROOTS (or DBS_FILE_ROOTS), a
registered model's file_roots, or a file field's storage, under the storage
name. Restoring onto a server whose paths differ, map the old roots to the new ones:
DBS_RESTORE_PATH_MAP = {"/srv/old/media": "/srv/new/media"}
Backups record the applied migration per app. If the target has drifted, the restore warns and names the apps. Rows for models and fields the target does not know are discarded.
Every server recreates its permissions and content types when it migrates, numbered in the order it migrated, so a backup refers to them by name rather than by number: a group's permissions, a user's permissions and a generic relation all land on the right rows of a server migrated in another order. A permission the server no longer has is left out with a warning; a foreign key it cannot find stops the restore and names the row.
Backups written in format 1 by earlier releases restore as before. See Upgrading to convert them.
{% endblock %}