Compare commits

...

2 Commits

Author SHA1 Message Date
Dax
d3e92dc3c8 Merge branch 'dev' into migrate-db 2026-02-18 17:53:42 -05:00
Dax Raad
fd03cf92f7 refactor: migrate src/storage/db.ts from Bun.file() to statSync
Replace Bun.file().size with statSync().size:

- Add statSync import from fs module

- Replace Bun.file(file).size with statSync(file).size in migrations() function

All 22 storage tests pass.
2026-02-18 10:46:21 -05:00

View File

@@ -10,7 +10,7 @@ import { Log } from "../util/log"
import { NamedError } from "@opencode-ai/util/error"
import z from "zod"
import path from "path"
import { readFileSync, readdirSync } from "fs"
import { readFileSync, readdirSync, statSync } from "fs"
import * as schema from "./schema"
declare const OPENCODE_MIGRATIONS: { sql: string; timestamp: number }[] | undefined
@@ -54,7 +54,7 @@ export namespace Database {
const sql = dirs
.map((name) => {
const file = path.join(dir, name, "migration.sql")
if (!Bun.file(file).size) return
if (!statSync(file).size) return
return {
sql: readFileSync(file, "utf-8"),
timestamp: time(name),