Skip to content

Commit 2a424e6

Browse files
Removed db.pragma api
1 parent e11e02e commit 2a424e6

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,10 @@ For example, since `run` returns `undefined` you can use the following queries t
1717
const changes = db.prepare("SELECT changes() AS changes;").get().changes;
1818
const lastInsertRowId = db.prepare("SELECT last_insert_rowid() AS id;").get().id;
1919
```
20+
21+
Also, since `db.pragma` is not available in `bun:sqlite`, you can run:
22+
23+
```javascript
24+
// non-transactional
25+
db.prepare("PRAGMA foreign_keys = ON;").run();
26+
```

index.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ declare namespace BetterSqlite3 {
2727
source: string,
2828
): BindParameters extends any[] ? Statement<BindParameters> : Statement<[BindParameters]>;
2929
transaction<F extends VariableArgFunction>(fn: F): Transaction<F>;
30-
pragma(source: string): any;
3130
close(): this;
3231
}
3332

index.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
const wrapper = function() {
22
if (process['isBun']) {
3-
const bunDbCtor = require("bun:sqlite").Database
4-
const ctor = function(...args) {
5-
const db = new bunDbCtor(...args)
6-
if (!db.pragma) {
7-
db.pragma = function() {}
8-
}
9-
return db
10-
}
11-
return ctor
3+
return require("bun:sqlite").Database
124
}
135

146
return require("better-sqlite3")

index.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const it = function() {
1111
it('should open in-memory database', () => {
1212
//when
1313
const db = new Database(":memory:")
14-
db.pragma('journal_mode = WAL')
1514
const query = db.prepare("select 'Hello world' as message;")
1615

1716
//then

0 commit comments

Comments
 (0)