feat: migrate bookmark storage from JSON/workspaceState to Drizzle ORM + SQLite#50
Draft
feat: migrate bookmark storage from JSON/workspaceState to Drizzle ORM + SQLite#50
Conversation
- Add drizzle-orm and better-sqlite3 dependencies - Create database schema (bookmarks, bookmark_groups, store_meta, group_info tables) - Create DatabaseService with save/load/delete/has operations - Update BookmarksController to use SQLite instead of workspaceState when createJsonFile=false - Keep workspaceState data migration path for backwards compatibility - Externalize better-sqlite3 native module in webpack config - Update .vscodeignore to include better-sqlite3 native module - Add skipLibCheck to tsconfig.json for drizzle-orm type compatibility Agent-Logs-Url: https://github.com/czfadmin/bookmarks/sessions/638f637a-8d9e-48ba-b0ba-89527569fdb3 Co-authored-by: czfadmin <13393959+czfadmin@users.noreply.github.com>
… INTEGER Agent-Logs-Url: https://github.com/czfadmin/bookmarks/sessions/638f637a-8d9e-48ba-b0ba-89527569fdb3 Co-authored-by: czfadmin <13393959+czfadmin@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
czfadmin
May 2, 2026 03:41
View session
|
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.
Replaces the existing bookmark persistence mechanism (
.vscode/bookmark-manager.jsonand VSCodeworkspaceState) with a SQLite database managed via Drizzle ORM, stored in the extension's home directory (~/.config/bookmark-manager/bookmarks.db).Schema
Four tables defined in
src/database/schema.ts:bookmarks— full bookmark data per workspacebookmark_groups— custom group definitionsstore_meta— per-workspace view preferences (viewType, groupView, sortedType, version)group_info— sorted order for grouping viewsNew:
DatabaseServicesrc/services/DatabaseService.tsexposes:save(workspaceName, storeInfo)— transactional upsert of all data for a workspaceload(workspaceName)— returnsIBookmarkStoreInfo | nullhas(workspaceName)— existence checkdelete(workspaceName)— removes all data for a workspaceController changes
BookmarksController.save()now routes to_saveToDatabase()instead ofworkspaceStatewhencreateJsonFile=false. On first load, oldworkspaceStatedata is migrated to SQLite automatically and cleared.Multi-workspace support:
_loadFromDatabase()merges data across all workspace folders, deduplicating groups and groupInfo entries.Bundling
better-sqlite3is a native addon — externalized in webpack config and explicitly included in.vscodeignore(negation pattern) so it ships with the packaged extension.skipLibCheck: trueadded totsconfig.jsonto suppress unrelated type errors from drizzle-orm's optional peer adapters.