chore: mark US-002 complete in prd.json and update progress log
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
4
prd.json
4
prd.json
@@ -33,8 +33,8 @@
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 2,
|
||||
"passes": false,
|
||||
"notes": ""
|
||||
"passes": true,
|
||||
"notes": "Completed: better-sqlite3 + drizzle-orm, 5-table schema, non-destructive push migration via CREATE TABLE IF NOT EXISTS, WAL mode enabled"
|
||||
},
|
||||
{
|
||||
"id": "US-003",
|
||||
|
||||
30
scripts/ralph/progress.txt
Normal file
30
scripts/ralph/progress.txt
Normal file
@@ -0,0 +1,30 @@
|
||||
# Ralph Progress Log
|
||||
Started: Thu Feb 19 16:33:18 CET 2026
|
||||
---
|
||||
|
||||
## Codebase Patterns
|
||||
- Vite configs use `.mts` extension to avoid ESM/CJS issues with electron-forge
|
||||
- Native Node modules (e.g. better-sqlite3) must be externalized in `vite.main.config.mts` rollupOptions.external
|
||||
- `AutoUnpackNativesPlugin` from `@electron-forge/plugin-auto-unpack-natives` must be first in plugins array in forge.config.ts for native module asar compatibility
|
||||
- DB is initialized in main process `app.on('ready')` handler; use `getDb()` singleton everywhere else in main process
|
||||
- All table IDs are TEXT (UUID); timestamps are INTEGER (unix ms); status/priority columns use TEXT with enum values
|
||||
- TypeScript types use `InferSelectModel` / `InferInsertModel` from drizzle-orm — no manual type duplication
|
||||
- `drizzle.config.ts` at project root points drizzle-kit CLI at `src/main/db/schema.ts`
|
||||
|
||||
---
|
||||
|
||||
## 2026-02-19 - US-002
|
||||
- Installed `better-sqlite3`, `drizzle-orm` (runtime) and `@types/better-sqlite3`, `drizzle-kit` (dev)
|
||||
- Created `src/main/db/schema.ts`: 5 tables (clients, projects, tasks, checkpoints, notes) with exported InferSelectModel/InferInsertModel types
|
||||
- Created `src/main/db/index.ts`: `initDb()` opens/creates `adiuva.db` at `app.getPath('userData')`, runs CREATE TABLE IF NOT EXISTS (non-destructive), enables WAL mode; `getDb()` singleton accessor
|
||||
- Updated `src/main/index.ts`: call `initDb()` in `app.on('ready')`
|
||||
- Updated `vite.main.config.mts`: externalized `better-sqlite3`
|
||||
- Updated `forge.config.ts`: added `AutoUnpackNativesPlugin`
|
||||
- Added `drizzle.config.ts` for drizzle-kit CLI
|
||||
- Typecheck: passes with zero errors
|
||||
- **Learnings for future iterations:**
|
||||
- better-sqlite3 is CommonJS with native addon; Vite must NOT bundle it — always add to rollupOptions.external
|
||||
- The CREATE TABLE IF NOT EXISTS approach satisfies "never destructive" and works perfectly in electron without needing migration file resolution
|
||||
- electron-forge rebuilds native modules automatically on `electron-forge start`; no manual rebuild step needed
|
||||
- `app.getPath('userData')` is only available after `app.on('ready')` fires — do not call earlier
|
||||
---
|
||||
Reference in New Issue
Block a user