Files
anomalyco_opencode/packages/opencode/test/fixture/db.ts
T

13 lines
533 B
TypeScript

import { rm } from "fs/promises"
import { Database } from "@opencode-ai/core/database/database"
import { Effect } from "effect"
import { disposeAllInstances } from "./fixture"
export async function resetDatabase() {
await disposeAllInstances().catch(() => undefined)
const dbPath = await Effect.runPromise(Database.configuredPath)
await rm(dbPath, { force: true }).catch(() => undefined)
await rm(`${dbPath}-wal`, { force: true }).catch(() => undefined)
await rm(`${dbPath}-shm`, { force: true }).catch(() => undefined)
}