Repository navigation
fix(backups): keep and restore Lens's files with each backup, not only the database - #385
Merged
Merged
Conversation
…y the database Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012qkVq3xnW9YJboxRYV4qSv
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012qkVq3xnW9YJboxRYV4qSv
This was referenced Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Before: a backup held only the database. Uploads, objects, media, frames, renditions, web pages, reports, exports, podcasts and certificates under
data_dirwere not in it, so restoring one brought back records whose files were missing.After: every backup (manual, scheduled, before-upgrade, before-restore,
lens backup) also keeps those files in<data_dir>/backups/.files/<name>/, and restoring puts them back. Files that haven't changed since the previous backup are hard links to its copy, so later backups take only the room of what changed. The download and the sealed copy on a storage connection carry the files too, as one.tar.gzholding<name>and<name>.files/, and Bring back restores them. Left out are things Lens fetches or rebuilds itself (models,bin,python,cache, the search index), temporary files (tmp,locks,logs, unfinished uploads) andsecret.key. Older backups show database only and leave files alone when restored.How: there is a new
app/domain/datafiles.pywithsnapshot,restore,dropandtidy.migrations.backupsnapshots after the database part.backups.restorerestores the files first, puts them back from the before-restore backup if the database part fails, anddelete/prune drop them. A backup is refused when the disk hasn't room for the changed files.Backup.fileswas added to the API.Motivation and Context
Adeel: "Backup is only backing up db but not assets etc".
Types of changes
!in the title)Checklist:
make hookschecks it on commit).tests/api/test_backups.py: kept, linked, downloaded, restored, deleted, copied to a connection and brought back; embedded and SurrealDB server).docs/accordingly (docs/database.md#backups,docs/deployment.md).## UnreleasedinCHANGELOG.md.Done questions (AGENTS.md)
/api/v1/admin/backupsAPI, withfileson each backup.make openapi) updated.🤖 Generated with Claude Code
https://claude.ai/code/session_012qkVq3xnW9YJboxRYV4qSv
Generated by Claude Code