Skip to content

Commit 0d673b6

Browse files
committed
feat(all worker dialects)!: remove built-in pragmas
1 parent 0598782 commit 0d673b6

File tree

7 files changed

+5
-42
lines changed

7 files changed

+5
-42
lines changed

packages/dialect-bun-worker/src/driver.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,9 @@ export class BunWorkerDriver implements Driver {
3737
})
3838
this.connection = new BunWorkerConnection(this.worker, this.mitt)
3939

40-
this.config?.usePRAGMA && await this.optimzePragma(this.connection)
41-
4240
await this.config?.onCreateConnection?.(this.connection)
4341
}
4442

45-
private async optimzePragma(conn: DatabaseConnection): Promise<void> {
46-
await conn.executeQuery(CompiledQuery.raw('PRAGMA cache_size = 4096;'))
47-
await conn.executeQuery(CompiledQuery.raw('PRAGMA journal_mode = WAL;'))
48-
await conn.executeQuery(CompiledQuery.raw('PRAGMA temp_store = MEMORY;'))
49-
await conn.executeQuery(CompiledQuery.raw(`PRAGMA page_size = ${32 * 1024};`))
50-
await conn.executeQuery(CompiledQuery.raw('PRAGMA synchronous = NORMAL;'))
51-
}
52-
5343
async acquireConnection(): Promise<DatabaseConnection> {
5444
// SQLite only has one single connection. We use a mutex here to wait
5545
// until the single connection has been released.

packages/dialect-bun-worker/src/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ export type BunWorkerDialectConfig = {
1111
*/
1212
url?: string
1313
onCreateConnection?: (connection: DatabaseConnection) => Promisable<void>
14-
/**
15-
* use built-in pragmas
16-
*/
17-
usePRAGMA?: boolean
1814
/**
1915
* use bun:sqlite's built-in statment cache
2016
* @see https://bun.sh/docs/api/sqlite#query

packages/dialect-bun-worker/test/index.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ describe('test', () => {
3030
int8: new Uint8Array([1, 2, 3]),
3131
})
3232
.execute()
33-
const { age, name, int8 } = await db.selectFrom('test').selectAll().limit(1).executeTakeFirstOrThrow()
33+
const { age, name, int8 } = await db
34+
.selectFrom('test')
35+
.selectAll()
36+
.limit(1)
37+
.executeTakeFirstOrThrow()
3438
expect(age).toStrictEqual(18)
3539
expect(name).toStrictEqual('test')
3640
expect(int8).toStrictEqual(Uint8Array.from([1, 2, 3]))

packages/dialect-sqlite-worker/src/driver.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,9 @@ export class SqliteWorkerDriver implements Driver {
3030
})
3131
this.connection = new SqliteWorkerConnection(this.worker, this.emit)
3232

33-
this.config.usePRAGMA && await this.optimzePragma(this.connection)
34-
3533
await onCreateConnection?.(this.connection)
3634
}
3735

38-
private async optimzePragma(conn: DatabaseConnection): Promise<void> {
39-
await conn.executeQuery(CompiledQuery.raw('PRAGMA cache_size = 4096;'))
40-
await conn.executeQuery(CompiledQuery.raw('PRAGMA journal_mode = WAL;'))
41-
await conn.executeQuery(CompiledQuery.raw('PRAGMA temp_store = MEMORY;'))
42-
await conn.executeQuery(CompiledQuery.raw(`PRAGMA page_size = ${32 * 1024};`))
43-
}
44-
4536
async acquireConnection(): Promise<DatabaseConnection> {
4637
// SQLite only has one single connection. We use a mutex here to wait
4738
// until the single connection has been released.

packages/dialect-sqlite-worker/src/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ export type SqliteWorkerDialectConfig = {
1414
*/
1515
option?: Options
1616
onCreateConnection?: (connection: DatabaseConnection) => Promisable<void>
17-
/**
18-
* use built-in pragmas
19-
*/
20-
usePRAGMA?: boolean
2117
}
2218

2319
export class SqliteWorkerDialect implements Dialect {

packages/dialect-wasqlite-worker/src/driver.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,9 @@ export class WaSqliteWorkerDriver implements Driver {
3535
})
3636
this.connection = new WaSqliteWorkerConnection(this.worker, this.mitt)
3737

38-
this.config.usePRAGMA && await this.optimzePragma(this.connection)
39-
4038
await this.config.onCreateConnection?.(this.connection)
4139
}
4240

43-
private async optimzePragma(conn: DatabaseConnection): Promise<void> {
44-
await conn.executeQuery(CompiledQuery.raw('PRAGMA cache_size = 4096;'))
45-
await conn.executeQuery(CompiledQuery.raw('PRAGMA journal_mode = WAL;'))
46-
await conn.executeQuery(CompiledQuery.raw('PRAGMA temp_store = MEMORY;'))
47-
await conn.executeQuery(CompiledQuery.raw(`PRAGMA page_size = ${32 * 1024};`))
48-
await conn.executeQuery(CompiledQuery.raw('PRAGMA synchronous = NORMAL;'))
49-
}
50-
5141
async acquireConnection(): Promise<DatabaseConnection> {
5242
// SQLite only has one single connection. We use a mutex here to wait
5343
// until the single connection has been released.

packages/dialect-wasqlite-worker/src/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ export interface WaSqliteWorkerDialectConfig {
2323
*/
2424
worker?: Worker
2525
onCreateConnection?: (connection: DatabaseConnection) => Promise<void>
26-
/**
27-
* use built-in pragmas
28-
*/
29-
usePRAGMA?: boolean
3026
}
3127
export class WaSqliteWorkerDialect implements Dialect {
3228
readonly #config: WaSqliteWorkerDialectConfig

0 commit comments

Comments
 (0)