fix(database): unify session DB — remove channel-based path splitting - #190
Merged
Merged
Conversation
…#188) - Remove STABLE_CHANNELS, consolidateLocalDb, OPENCODE_DISABLE_CHANNEL_DB logic - path() now returns opencode.db for all channels (OPENCODE_DB override retained) - Add consolidateChannelDbs(): one-time startup merge of legacy opencode-*.db files via ATTACH + INSERT OR IGNORE per table - Largest DB promoted by rename (no full copy); sources renamed to *.db.merged - Foreign keys disabled during merge; WAL checkpointed on sources before ATTACH - Idempotent: partial failures leave sources for retry on next startup
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR unifies session storage in ChangesUnified session database
Estimated code review effort: 4 (Complex) | ~45 minutes Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
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.
Closes #188
Summary
Removes all channel-based database path logic. All channels now write to
opencode.db. A one-time consolidation on first startup merges rows from legacy channel-named DBs (opencode-*.db) via ATTACH + INSERT OR IGNORE per table, then backs up sources as*.db.merged.Changes
STABLE_CHANNELS,consolidateLocalDb,InstallationChannelimport, andOPENCODE_DISABLE_CHANNEL_DBenv var logicpath(): returnsjoin(Global.Path.data, "opencode.db")for all channels (OPENCODE_DBenv var override retained)consolidateChannelDbs(targetPath): runs once synchronously at startup viabun:sqlite:opencode-*.dbfiles (skips*.db.merged)opencode.dbdoesn't exist, renames the largest source to become it (no full copy)*.db.mergedOPENCODE_DBenv var is setStandalone script
A
merge-opencode-dbs.shbash script (usingsqlite3CLI) is available separately for users who want to merge before upgrading.Summary by CodeRabbit
opencode.db.