2026-02-27 20:36:39 +00:00
|
|
|
import { rm } from "fs/promises"
|
2026-05-31 01:08:38 +00:00
|
|
|
import { Database } from "@opencode-ai/core/database/database"
|
2026-05-02 14:56:15 +00:00
|
|
|
import { disposeAllInstances } from "./fixture"
|
2026-02-27 20:36:39 +00:00
|
|
|
|
|
|
|
|
export async function resetDatabase() {
|
2026-05-02 14:56:15 +00:00
|
|
|
await disposeAllInstances().catch(() => undefined)
|
2026-05-31 01:08:38 +00:00
|
|
|
const dbPath = Database.path()
|
2026-05-14 22:39:10 +00:00
|
|
|
await rm(dbPath, { force: true }).catch(() => undefined)
|
|
|
|
|
await rm(`${dbPath}-wal`, { force: true }).catch(() => undefined)
|
|
|
|
|
await rm(`${dbPath}-shm`, { force: true }).catch(() => undefined)
|
2026-02-27 20:36:39 +00:00
|
|
|
}
|