Skip to content

Commit 706dce1

Browse files
committed
fix sqlite :memory:
1 parent 0d64f7e commit 706dce1

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/databases/sqlite-bun.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ import type {ColumnSchema} from "../runtime/index.js";
66
import {getColumnType} from "./sqlite.js";
77

88
export default function sqlite(
9-
{path = ":memory:"}: SQLiteConfig,
9+
{path}: SQLiteConfig,
1010
context: DatabaseContext
1111
): QueryTemplateFunction {
12-
if (path !== undefined) path = join(context.cwd, path);
1312
return async (strings, ...params) => {
1413
const date = new Date();
15-
const database = new Database(path);
14+
const database = new Database(path === undefined ? ":memory:" : join(context.cwd, path));
1615
try {
1716
const statement = database.prepare(strings.join("?"));
1817
const rows = statement.all(...params) as Record<string, unknown>[];

src/databases/sqlite-node.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ import type {ColumnSchema} from "../runtime/index.js";
66
import {getColumnType} from "./sqlite.js";
77

88
export default function sqlite(
9-
{path = ":memory:"}: SQLiteConfig,
9+
{path}: SQLiteConfig,
1010
context: DatabaseContext
1111
): QueryTemplateFunction {
12-
if (path !== undefined) path = join(context.cwd, path);
1312
return async (strings, ...params) => {
1413
const date = new Date();
15-
const database = new DatabaseSync(path);
14+
const database = new DatabaseSync(path === undefined ? ":memory:" : join(context.cwd, path));
1615
try {
1716
const statement = database.prepare(strings.join("?"));
1817
const rows = statement.all(...params) as Record<string, unknown>[];

0 commit comments

Comments
 (0)