fix(portable): 避免数据目录切换时丢失设置和代码片段 - #6771
Merged
Merged
Conversation
zipg
force-pushed
the
codex/fix-windows-portable-persistence
branch
from
August 30, 2026 11:15
c212e8b to
bb0f290
Compare
zipg
force-pushed
the
codex/fix-windows-portable-persistence
branch
from
August 30, 2026 11:23
bb0f290 to
016c285
Compare
zipg
marked this pull request as ready for review
August 30, 2026 15:14
t8y2
approved these changes
Aug 31, 2026
t8y2
left a comment
Owner
There was a problem hiding this comment.
已核对,修复方向和实现都正确,无阻塞意见。
根因确认:sqlite_db_has_user_data 同时用于源库非空与目标库已有数据判断,而原 USER_DATA_TABLES 漏掉了 9 张持久化用户表——只保存过设置或代码片段的源库会被判为空而跳过迁移,只含设置的目标库会被当作空库覆盖。加入后两个方向同时修复。完整性核对:对照全部建表语句,未纳入的仅剩两张缓存表,排除正确。
作用域核对:仅便携模式数据目录切换时触发,不影响常规安装和非 Windows;导入在 Storage::open 之前执行,无误判风险;旧目录数据是拷贝不是删除。
非阻塞建议:USER_DATA_TABLES 是手工清单,今后新增持久化表漏加会复现同类 bug,建议后续补一个从 sqlite_master 导出全部表并断言覆盖的守护测试。
Owner
|
Thanks for the contribution! Merged in 2779a43, will be released in the next version. |
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.
问题
Windows 便携版的数据目录发生切换时,启动兜底迁移仅将连接、历史和 SQL 库等表识别为用户数据。
app_settings和app_state未被识别,导致仅保存了设置或自定义代码片段的数据库被误判为空,启动后表现为恢复默认。修复
验证
cargo test -p dbx-core import_user_data_db --lib:7 passedcargo test -p dbx-core --lib:5164 passed, 0 failed, 59 ignored(变基前全量验证)cargo test --manifest-path src-tauri/Cargo.toml data_dir --lib:9 passed(变基前验证)cargo fmt --all -- --checkgit diff --check待验证
当前开发环境为 macOS,尚未完成 Windows 便携版实际退出、重启及数据目录切换验证,因此先提交为草稿 PR。