opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat: refactor storage into storage interface, add sqlite storage provider

Open pschiel opened this issue 1 day ago • 2 comments

(WIP)

Proposal: use Storage Interface (re: sqlite topic)

  • refactor Storage into using a StorageProvider.Interface
  • move JSON logic into JsonStorageProvider
  • add SqliteStorageProvider
  • extend signature of list() with orderBy and limit (so providers can take advantage of index/sorting)
  • configurable schema, allowing to extract certain (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 init to create new db
  • opencode sqlite import to import json storage into sqlite
  • set storage.backend to sqlite in opencode.json config

pschiel avatar Jan 17 '26 03:01 pschiel