Skip to content

fix: switch from better-sqlite3 to bun:sqlite (built-in) - #15

Merged
moderniselife merged 1 commit into
developfrom
feature/schrodrive-refactor
Jun 6, 2026
Merged

fix: switch from better-sqlite3 to bun:sqlite (built-in)#15
moderniselife merged 1 commit into
developfrom
feature/schrodrive-refactor

Conversation

@moderniselife

Copy link
Copy Markdown
Owner

better-sqlite3 is a native addon that requires node-gyp + make to compile, which fails in Bun's Docker image. Bun has a built-in SQLite module with a nearly identical API.

Changes:

  • Import { Database } from 'bun:sqlite' instead of better-sqlite3
  • Use db.exec('PRAGMA ...') instead of db.pragma('...')
  • Use new Database(path, { create: true }) constructor
  • Remove .changes property usage (bun:sqlite .run() returns void)
  • Add 'bun-types' to tsconfig.json types array
  • Remove better-sqlite3 and @types/better-sqlite3 from package.json

better-sqlite3 is a native addon that requires node-gyp + make to compile,
which fails in Bun's Docker image. Bun has a built-in SQLite module with
a nearly identical API.

Changes:
- Import { Database } from 'bun:sqlite' instead of better-sqlite3
- Use db.exec('PRAGMA ...') instead of db.pragma('...')
- Use new Database(path, { create: true }) constructor
- Remove .changes property usage (bun:sqlite .run() returns void)
- Add 'bun-types' to tsconfig.json types array
- Remove better-sqlite3 and @types/better-sqlite3 from package.json
@moderniselife
moderniselife merged commit 39743b4 into develop Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant