feat(desktop): replace lowdb with SQLite for local database

Merged
SA
1y ago
+2163-1189

Summary

  • Adds @superset/local-db package with Drizzle ORM schema for SQLite
  • Migrates all database operations from lowdb (db.json) to SQLite using better-sqlite3
  • Updates all tRPC routers to use Drizzle queries instead of lowdb
  • Removes lowdb dependency
  • Adds UUID defaults for all ID fields (prep for local-first architecture)

Changes

  • New package: packages/local-db/ - Drizzle schema, relations, and Zod validators
  • Desktop app: Updated all routers (projects, workspaces, terminal, settings, external, config, branches) to use SQLite
  • Native modules: Added better-sqlite3 support for Electron builds
  • Cleanup: Removed old src/main/lib/db/ folder and lowdb dependency

Test plan

  • Typecheck passes
  • App starts and creates SQLite database
  • Projects, workspaces, and worktrees persist correctly
  • Settings (ringtones, terminal presets) work
  • Notifications look up workspace names correctly

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Desktop app now uses a local SQLite-backed database with automatic migration from the legacy JSON store.
    • Packaging updated to include native DB binaries and to bundle database migrations into app resources.
  • Chores

    • App-wide data layer migrated to a structured ORM-backed local-db package and updated to use new schemas.
    • Legacy in-file DB and old schema exports removed; build and type tooling for local-db added.

✏️ Tip: You can customize this high-level summary in your review settings.