-
-
Notifications
You must be signed in to change notification settings - Fork 172
Backing up database file via the cli #704 #712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Backing up database file via the cli #704 #712
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 files reviewed, 2 comments
Edit Code Review Agent Settings | Greptile
React with 👍 or 👎 to share your feedback on this new summary format
|
@swaploard please fix failing clippy checks |
|
Sure |
|
There was one formatting error for the string that I fixed, but some errors were coming from the Git workflows, so I pulled from the main branch in hope of fixing those errors. I think @xav-db can help me here. |
|
should be okay now I think |
|
@swaploard please fix clippy checks |
|
should be simple unused import fix |
xav-db
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now
Description
Feature]: Backing up database file via the CLI #704
Related Issues
#704
Closes #
Checklist when merging to main
rustfmthelix-cli/Cargo.tomlandhelixdb/Cargo.tomlAdditional Notes
Implemented a backup CLI to back up the selected instance using the command: cargo run --bin helix backup dev --output . This addresses the issue mentioned in the feature request: "Backing up database file via the CLI" (#704).
If a path is not provided, the CLI will create a directory in the current path with a timestamp. If the file size exceeds 10GB, the CLI will prompt for confirmation before proceeding. Additionally, if read/write permissions are unavailable, it will print a permission error message.
Greptile Summary
helix backupCLI command to copy instance database files (data.mdbandlock.mdb) to a backup directory with optional custom output pathImportant Files Changed
Sequence Diagram
sequenceDiagram participant User participant CLI as "helix backup" participant ProjectContext participant FileSystem User->>CLI: "helix backup <instance> --output <path>" CLI->>ProjectContext: "find_and_load()" ProjectContext-->>CLI: "project context" CLI->>ProjectContext: "get_instance(instance_name)" ProjectContext-->>CLI: "instance config" CLI->>FileSystem: "check data_file.exists()" FileSystem-->>CLI: "exists" CLI->>FileSystem: "metadata(data_file)" FileSystem-->>CLI: "file size" CLI->>FileSystem: "metadata(lock_file)" FileSystem-->>CLI: "file size" alt size > 10GB CLI->>User: "Warn: size is X GB" CLI->>User: "Confirm: continue?" User-->>CLI: "yes/no" alt user cancels CLI->>User: "Backup aborted" end end CLI->>FileSystem: "check_read_write_permission(data_file)" FileSystem-->>CLI: "permissions ok" CLI->>FileSystem: "check_read_write_permission(lock_file)" FileSystem-->>CLI: "permissions ok" CLI->>FileSystem: "copy(data_file)" FileSystem-->>CLI: "copied" CLI->>FileSystem: "copy(lock_file)" FileSystem-->>CLI: "copied" CLI->>User: "Backup created successfully"