Repository navigation
dbtool: defaultBackupDir / backupDir in dbtool.yml (dbtool backup + dbtool-gui) - #663
Merged
Merged
Conversation
…l backup` (#658) dbtool.yml can now name where backups go, so a deployment (an installer, say) can pre-configure it: defaultBackupDir: D:/backups # store-wide fallback profiles: prod: backupDir: D:/backups/prod # per-profile override Resolution mirrors pluginsDir: the profile's backupDir, else defaultBackupDir. - ProfileStore parses and saves both keys (a blank key means none) and offers EffectiveBackupDir(profile). - `dbtool backup`: a bare file name in --output, or no --output at all (it then writes <profile>-<YYYYMMDD-HHMMSS>.zip), goes into that folder, which is created if missing; a path with a directory part is used as given. The pure decision lives in Config::ResolveBackupOutput, so it is tested without I/O. Without a configured folder, --output is required as before. - `dbtool add-profile --backup-dir <DIR>` and `list-profiles` (BACKUPDIR column). - ProfileFileEditor writes backupDir. Its rendered fields and the document it verifies its own edit against now come from one table: the verification list was a second copy and refused every edit that carried the new field. Tests: store parsing, precedence and round trip; the editor; the resolution rules and generated names; and test_dbtool.py end to end (add-profile --backup-dir, list-profiles, bare name, generated name, explicit path, defaultBackupDir fallback, and the unchanged error without a folder). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
When no folder was chosen in Settings, the default backup folder is now the defaultBackupDir of the loaded dbtool.yml if it names one, else the platform default. AppController pushes it to ManagedBackupController on every profile reload, and Settings' placeholder / help text show the folder that will really be used. A folder chosen in Settings still wins. A per-profile backupDir is not used here: the Backups page keeps every profile's archive in one folder. Tests: ManagedBackupController (configured vs chosen vs platform default) and AppController (loading a file with and without the key). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Carry backupDir through ProfileRequest, which master introduced for add-profile. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…r in ProfileRequest literals Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Summary
dbtool.ymlcan now name where backups go, so a deployment (for example an installer) can pre-configure it anddbtoolanddbtool-guiboth honor it.Closes #658
Resolution
Mirrors
pluginsDir: the profile'sbackupDir, then the top-leveldefaultBackupDir, then the previous behaviour.dbtool backup: a bare file name in--output, or no--outputat all (it then writes<profile>-<YYYYMMDD-HHMMSS>.zip, local time), goes into that folder, which is created if missing. A path with a directory part is used exactly as given. The file that was written is printed. With no folder configured--outputis required, as before.dbtool add-profile --backup-dir <DIR>, andlist-profilesshows an effectiveBACKUPDIRcolumn.dbtool-gui:defaultBackupDirbecomes the default backup folder, unless a folder was chosen in Settings (which still wins). Settings' placeholder and help show the folder that will really be used.docs/dbtool.mdand the GUI README.Decisions worth a look
backupDir. The Backups page keeps every profile's archive in one folder (one folder card, one folder check,<profile>.zipinside it), so only the store-widedefaultBackupDirapplies there; a per-profilebackupDiris a CLI feature. Honoring it in the GUI would mean a per-profile folder model, which felt out of scope. The issue's "use the resolved folder" is ambiguous on this, so I took the reading that does not change the page's model. Say if you want the other one.--connection-stringwithout--profileapplies no profile, and therefore no backup folder, like every other profile default.--outputstays required there.pluginsDir.ProfileFileEditorlisted the fields of a new profile in two places: the text it renders, and the document it verifies its own edit against. Adding a field to only one made everyadd-profilethat carried it fail with "could not be edited exactly". Both now come from one table, so they cannot drift apart again.Performance impact
None: configuration parsing and a path decision.
Risk assessment
dbtool backupbehaves exactly as before.ProfileandNewProfilegained a defaulted field at the end, so existing aggregate initialisations are unaffected._.dbtool/main.cpp'sadd-profile(it moves it onto a sharedAddProfileToFile) andProfileFileEditorTests.cpp. Whichever merges second needs a small rebase:ProfileRequestthere will need abackupDirfield and the--backup-dirwiring moved onto it. I kept this PR onmasterso it does not depend on dbtool-gui: Backup & restore panel, Settings in Simple mode, add profiles #662.Testing
[backup-dir]tests,[ProfileStore],[ProfileFileEditor],[profile-add],test_dbtool.py --test-env sqlite3(which now coversadd-profile --backup-dir,list-profiles, bare name, generated name, explicit path,defaultBackupDirfallback and the unchanged error without a folder), and the dbtool-gui Catch2 and QML suites.dbtool,dbtool-guiand the GUI test targets (Catch2, QML, smoke) build and pass.clang-tidy, MSSQL and PostgreSQL, the C++26 reflection and modules builds. No database code changed.%APPDATA%\dbtool\dbtool.ymlis auto-discovered. They pass on CI and on Linux./simplifywas not run.🤖 Generated with Claude Code