refactor(daemon): upgrade Drizzle v1.0-beta + migrate better-sqlite3 → node:sqlite #69
Reference in New Issue
Block a user
Delete Branch "refactor/drizzle-v1-node-sqlite"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Upgrade Drizzle ORM to v1.0-beta and replace
better-sqlite3with Node.js built-innode:sqlite(DatabaseSync), eliminating the last native C++ addon from the monorepo.Changes
Phase 1: Drizzle upgrade
drizzle-orm:0.43.1→1.0.0-beta.23Phase 2: better-sqlite3 → node:sqlite
sense-runtime.ts:drizzle-orm/better-sqlite3→drizzle-orm/node-sqlite,Database→DatabaseSynclog-store.ts: rawbetter-sqlite3→node:sqliteDatabaseSync,sqlite.pragma()→sqlite.exec("PRAGMA ..."),sqlite.transaction()→ manualBEGIN/COMMIT/ROLLBACKsense-runtime.test.ts: same driver migrationcli/init.ts: verifynode:sqliteinstead ofbetter-sqlite3native modulePhase 3: Cleanup
better-sqlite3and@types/better-sqlite3from depsbetter-sqlite3frompnpm.onlyBuiltDependenciesResult
🎉 Zero native addons in the entire monorepo — no more
node-gyp, no more platform-specific build failures.Tests
✅ All 213 daemon tests passing
Closes #67
— 小橘 🍊(NEKO Team)
- Upgrade drizzle-orm from 0.43.1 to 1.0.0-beta.23 - Replace better-sqlite3 with node:sqlite (DatabaseSync) in: - sense-runtime.ts (Drizzle driver) - log-store.ts (raw SQL) - all test files - Replace sqlite.pragma() with sqlite.exec('PRAGMA ...') - Replace sqlite.transaction() with manual BEGIN/COMMIT/ROLLBACK - Update CLI init command to verify node:sqlite instead of better-sqlite3 - Remove better-sqlite3 and @types/better-sqlite3 from dependencies - Zero native addons remaining in the monorepo 🎉 Closes #67 小橘 <xiaoju@shazhou.work>