• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / toolhive-studio / 22192519146

19 Feb 2026 05:25PM UTC coverage: 56.334% (+0.2%) from 56.125%
22192519146

Pull #1661

github

web-flow
Merge 8ea96e427 into 67271ad6d
Pull Request #1661: feat(db): add SQLite persistence layer with incremental read migration via feature flags

2659 of 4952 branches covered (53.7%)

270 of 439 new or added lines in 23 files covered. (61.5%)

15 existing lines in 3 files now uncovered.

4292 of 7387 relevant lines covered (58.1%)

114.05 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

55.0
/main/src/db/database.ts
1
import Database from 'better-sqlite3'
2
import { app } from 'electron'
3
import path from 'path'
4
import log from '../logger'
5

6
let db: Database.Database | null = null
4✔
7
let dbWritable = true
4✔
8

9
export function getDb(): Database.Database {
10
  if (!db) {
18!
11
    const dbPath = path.join(app.getPath('userData'), 'desktop.db')
18✔
12
    log.info({ dbPath })
18✔
13
    db = new Database(dbPath)
18✔
14
    db.pragma('journal_mode = WAL')
18✔
15
    db.pragma('foreign_keys = ON')
18✔
16
    log.info(`[DB] Opened database at ${dbPath}`)
18✔
17
  }
NEW
18
  return db
×
19
}
20

21
export function closeDb(): void {
NEW
22
  if (db) {
×
NEW
23
    db.close()
×
NEW
24
    db = null
×
NEW
25
    log.info('[DB] Database closed')
×
26
  }
27
}
28

29
export function isDbWritable(): boolean {
30
  return dbWritable
14✔
31
}
32

33
export function setDbWritable(writable: boolean): void {
NEW
34
  dbWritable = writable
×
35
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc