2026-02-27 20:36:39 +00:00
|
|
|
import { rm } from "fs/promises"
|
2026-04-27 18:33:33 +00:00
|
|
|
import { Database } from "@/storage/db"
|
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-02-27 20:36:39 +00:00
|
|
|
Database.close()
|
|
|
|
|
await rm(Database.Path, { force: true }).catch(() => undefined)
|
|
|
|
|
await rm(`${Database.Path}-wal`, { force: true }).catch(() => undefined)
|
|
|
|
|
await rm(`${Database.Path}-shm`, { force: true }).catch(() => undefined)
|
|
|
|
|
}
|