opencode
opencode copied to clipboard
feat: refactor storage into storage interface, add sqlite storage provider
(WIP)
Proposal: use Storage Interface (re: sqlite topic)
- refactor
Storageinto using aStorageProvider.Interface - move JSON logic into
JsonStorageProvider - add
SqliteStorageProvider - extend signature of
list()withorderByandlimit(so providers can take advantage of index/sorting) - configurable schema, allowing to
extractcertain (nested) keys from the data blob into separate columns - sqlite command/util to export/import from/to JSON
Effect
- 100% backwards compatible - can switch storage via config
- open for more storage engines
- eliminate discussion about schema of preference
Migration steps
-
opencode sqlite initto create new db -
opencode sqlite importto import json storage into sqlite - set
storage.backendtosqliteinopencode.jsonconfig
Thanks for your contribution!
This PR doesn't have a linked issue. All PRs must reference an existing issue.
Please:
- Open an issue describing the bug/feature (if one doesn't exist)
- Add
Fixes #<number>orCloses #<number>to this PR description
See CONTRIBUTING.md for details.
The following comment was made by an LLM, it may be inaccurate:
No duplicate PRs found